Hello everyone I'm working on a project for java class and I'm not advanced enough to do anything fancy, I have the basics of the program but for some reason it never adds up right. Can anyone help me correct this issue? thanks. Also i changed the name of doubleroom to roomroom because I thought doubleroom was messing with the math but apparently not lol.
import java.util.Scanner; class resort4 { public static void main (String[] args) { int staytype; //create int, some with values, some get values later. int roomtype; int weekdayrate = 5; int weekendrate = 20; int holidayrate = 50; int smokingroom = 40; int handicaproom = 10; int nonsmokingroom = 50; int book1; int book2; int book3; int keepgoing; int keepgoing2; int stayday; int finalprice = 0; int singleroom = 60; int roomroom = 100; int VIP = 500; int smokingornot; //find smokingornot based on user input System.out.println("Smoking, Non-Smoking, or Handicap?\n 1 for Smoking" + "\n 2 for Non-Smoking" + "\n 3 for Handicap"); Scanner keyboard = new Scanner(System.in); smokingornot = keyboard.nextInt(); //smoking booking if (smokingornot == 1) //smoking room conditions { if (smokingroom <= 0) System.out.println("Smoking room unavailable, please try" //out of smoking rooms + "again."); else System.out.println(smokingroom + " " + "Smoking rooms " + "available."); //smoking rooms are still available System.out.println("Would you like to continue?\n" + "1 for yes\n" + "2 for no"); book1 = keyboard.nextInt(); //move to next part of program if user has made no errors if (book1 == 2) System.out.println("Room not booked, please restart"); else smokingroom--; //removes a smokingroom from count } //non-smoking booking if (smokingornot == 2) { if (nonsmokingroom <= 0) System.out.println("Non-Smoking room unavailable, please" + " try again."); else System.out.println(nonsmokingroom + " " + "Non-Smoking " + "rooms available."); System.out.println("Would you like to continue?\n" + "1 for yes\n" + "2 for no"); book2 = keyboard.nextInt(); //user input to continue if (book2 == 2) System.out.println("Room not booked, please restart."); else nonsmokingroom--; //removes a non smoking room from count } //handicap booking if (smokingornot == 3) { if (handicaproom <= 0) System.out.println("No Handicap rooms available, please " + "try again."); else System.out.println(handicaproom + " " + "Handicap rooms " + "available."); System.out.println("Would you like to continue?\n" + "1 for yes\n" + "2 for no"); book3 = keyboard.nextInt(); //gets userinput to continue if (book3 == 2) System.out.println("Room not booked, please restart."); else handicaproom--; //removes a handicap room from count } { System.out.println("What type of room would you like?\n" + "1 for Single\n" + "2 for Double\n" + "3 for VIP"); roomtype = keyboard.nextInt(); //assigns input to roomtype if (roomtype == 1) //single room arrangements System.out.println("Single room arrangements will be made."); finalprice = finalprice + singleroom; if (roomtype == 2) //doubleroom arrangements System.out.println("Double room arrangements will be made."); if (roomtype == 3) System.out.println("VIP room arrangements will be made."); finalprice = finalprice + VIP; } { System.out.println("How many nights will the guest be staying?\n" + "Enter a number 1, 2, 3, etc."); //prompt for number of nights stayed at hotel stayday = keyboard.nextInt(); //assigns stayday a value } System.out.println("What type of rates should we apply?\n" + "1 for Weekday\n" + "2 for Weekend\n" + "3 for Holiday"); staytype = keyboard.nextInt(); //assigns staytype a value { if (staytype == 1) finalprice = finalprice + weekdayrate; //adds weekday rates if (staytype == 2) finalprice = finalprice + weekendrate; //adds weekend rates else finalprice = finalprice + holidayrate; //adds holiday rates } { if (roomtype == 2) finalprice = finalprice + roomroom; //adds double room rate to final price if necessary } finalprice = finalprice * stayday; //multiplies nights stayed to final price System.out.println("Your total is" + " " + finalprice); //prints out final price } }