Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class bush {
- public static void main(String[] args) {
- int economy = 35;
- int compact = 45;
- int standard = 95;
- double base = 0;
- int choice = 0;
- int days = 0;
- int member = 0;
- int PEP = 0;
- int discount = 0;
- double exec = 0;
- Scanner in = new Scanner (System.in);
- System.out.println("Available cars: 1 for Economy, 2 for Compact, 3 for Standard");
- System.out.println("Please choose the rental car: ");
- choice = in.nextInt();
- System.out.print("Please enter the number of rental days: ");
- days = in.nextInt();
- System.out.print("Club member: 1 for yes, 0 for no: ");
- member = in.nextInt();
- if (member == 1) {
- System.out.println("Plantinum Executive Package?: 1 for yes, 0 for no: ");
- PEP = in.nextInt();}
- if (choice == 1) {
- base = ((double)(economy * days));
- System.out.println("Base: " + days + " days for economy @ $35 per day: $" + (base));
- if (member == 1) {
- discount = ((days / 7)*economy);
- System.out.println("Club member discount: -$" + discount );}
- if (PEP == 1) {
- exec = (base * 0.15);
- System.out.println("Platinum Executive Package: +$" + (exec));}
- }else if (choice == 2) {
- base = ((double)(compact * days));
- System.out.println("Base: " + days + " days for compact @ $45 per day: $" + (base));
- if (member == 1) {
- discount = ((days / 7)*compact);
- System.out.println("Club member discount: -$" + discount );}
- if (PEP == 1) {
- exec = (base * 0.15);
- System.out.println("Platinum Executive Package: +$" + (exec));}
- System.out.println("Total Estimate for Rental: $" + (double)(base-discount+exec));
- if (choice == 3) {
- base = ((double)(standard * days));
- System.out.println("Base: " +days + " days for compact @ $45 per day: $" + (base));}
- if (member == 1) {
- discount = ((days / 7)*standard);
- System.out.println("Club member discount : -$" + discount);}
- if (PEP == 1) {
- exec = (base * 0.15);
- System.out.println("Platinum Executive Package: +$" + (exec));}
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement