Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- }
- public static void main(String[] args)
- {
- Scanner input = new Scanner (System.in);
- int options = 0;
- int hardware2 = 2;
- int amountbook = 0;
- // Apart of purchasing texbooks
- double javabook = 59.99;
- double cplusbook = 49.99;
- int javaorcplus = 0;
- // buying hardware
- double laptop = 1000.00;
- double monitor = 250.00;
- int LTorMT = 0;
- // LT is laptop, MT is monitor
- System.out.println("1) Purchase textbooks");
- System.out.println("2) Purchase hardware");
- System.out.println("3) Show total and exit");
- options = input.nextInt();
- switch (options)
- {
- case 1:
- System.out.println("1) Purchase Java: How to Program ($59.99)");
- System.out.println("2) Purchase C++: How to Program ($49.99)");
- javaorcplus = input.nextInt();
- if (javaorcplus == 1)
- {
- System.out.println("How many? (1-5)");
- amountbook = input.nextInt();
- System.out.println("You have chosen " +
- amountbook);
- System.out.println("Your subtotal is " +
- amountbook * javabook);
- }
- else if (javaorcplus == 2)
- {
- System.out.println("How many? (1-5)");
- amountbook = input.nextInt();
- System.out.println("You have chosen " +
- amountbook);
- System.out.println("Your subtotal is"
- +amountbook * cplusbook);
- }
- break;
- case 2:
- System.out.println("1) Purchase Laptop ($1,000.00)");
- System.out.println("2) Purchase Monitor ($250.00)");
- LTorMT = input.nextInt();
- if (LTorMT == 1)
- {
- System.out.println(laptop);
- }
- else
- {
- System.out.println(monitor);
- }
- break;
- case 3:
- double total = totalpurchase(amountbook);
- System.out.println("Your total is " + total);
- break;
- default:
- System.out.println("Please pick an option");
- break;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement