Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void main(String[] args) {
- int basePrice = 1000, totalPrice = 0,width=0,length=0,numDrawers;
- //int newTotalPrice = totalPrice;
- Boolean repeat = true;
- Scanner scan= new Scanner(System.in);
- Scanner scan2= new Scanner(System.in);
- Scanner scan3= new Scanner(System.in);
- Scanner scan4 = new Scanner(System.in);
- while (repeat){
- System.out.println("\nDESK PRICE CALCULATOR"+ "\n");
- System.out.println("enter width and length of table:");
- System.out.print(">width: ");
- width=scan.nextInt();
- System.out.print(">length: ");
- length=scan.nextInt();
- int area = width*length;
- if (area > 1000){
- totalPrice = basePrice + area + 300;
- //int newTotalPrice = totalPrice;
- }
- else {
- totalPrice = basePrice + area;
- }
- System.out.println("\nPHP "+ totalPrice+ "\n");
- System.out.println("would you like to add drawers: Y/N");
- System.out.print("> ");
- String yn = scan2.nextLine();
- if (yn.equals("y")||yn.equals("Y")){
- System.out.print("\n"+"input number of drawers: "+"\n");
- System.out.print("> ");
- numDrawers = scan2.nextInt();
- int finNum = numDrawers * 50;
- totalPrice = totalPrice + finNum;
- System.out.println("\nPHP "+ totalPrice+ "\n");
- System.out.println("\n"+"Choose type of wood: " + "\nA. Narra" + "\nB. Pine");
- System.out.print("> ");
- String wood= scan3.nextLine();
- if (wood.equals("a")||wood.equals("A")){
- totalPrice = totalPrice + 100;
- System.out.println("TOTAL PRICE: PHP"+ totalPrice);
- System.out.println("\n"+"Would you like to make another order? Y/N");
- System.out.print("> ");
- String ynn = scan4.nextLine();
- if(ynn.equals("y")||ynn.equals("Y")){
- repeat = true;
- }
- else if (ynn.equals("n")||ynn.equals("N")){
- //repeat = false;
- System.exit(0);
- }
- }
- else if (wood.equals("b")||wood.equals("B")){
- totalPrice = totalPrice + 200;
- System.out.println("TOTAL PRICE: PHP "+ totalPrice);
- System.out.println("\n"+"Would you like to make another order? Y/N");
- System.out.print("> ");
- String ynn2 = scan4.nextLine();
- if(ynn2.equals("y")||ynn2.equals("Y")){
- repeat = true;
- }
- else if (ynn2.equals("n")||ynn2.equals("N")){
- //repeat = false;
- System.exit(0);
- }
- }
- }
- else if (yn.equals("n")||yn.equals("N")){
- System.out.println("\n" +"PHP "+totalPrice);
- //System.exit(0);
- System.out.println("\n"+"Choose type of wood: " + "\nA. Narra" + "\nB. Pine");
- System.out.print("> ");
- String wood2= scan3.nextLine();
- if (wood2.equals("a")||wood2.equals("A")){
- totalPrice = totalPrice + 100;
- System.out.println("TOTAL PRICE: PHP"+ totalPrice);
- System.out.println("\n"+"Would you like to make another order? Y/N");
- System.out.print("> ");
- String ynn3 = scan4.nextLine();
- if(ynn3.equals("y")||ynn3.equals("Y")){
- repeat = true;
- }
- else if (ynn3.equals("n")||ynn3.equals("N")){
- //repeat = false;
- System.exit(0);
- }
- }
- else if (wood2.equals("b")||wood2.equals("B")){
- totalPrice = totalPrice + 200;
- System.out.println("TOTAL PRICE: PHP "+ totalPrice);
- System.out.println("\n"+"Would you like to make another order? Y/N");
- System.out.print("> ");
- String ynn2 = scan4.nextLine();
- if(ynn2.equals("y")||ynn2.equals("Y")){
- repeat = true;
- }
- else if (ynn2.equals("n")||ynn2.equals("N")){
- //repeat = false;
- System.exit(0);
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement