Java- two strings that equal separate math functions output when user enters either word?
Up to the strings, everything is fine. I am VERY new to java. I'm looking to see if I'm heading in the right direction. I would like the user to either enter 'total' or 'person' to get the grand total or total per person. If the enter neither, I want it to say 'Please enter either one'. I want that to loop until they enter the right word. When they do, I want it to output the answer. I have the formulas below but I'm not sure if the formatting is correct. I have to use two loops. I'm preferring a while and if else loop. Thank you!!!!!
import java.util.Scanner;
import java.util.Properties;
public class Un {
public static void main ( String[] args ) {
System.out.println("This program calculates the cost of a class reunion event.");
System.out.println("It gives back the total cost and the cost per person.");
Scanner in = new Scanner(System.in);
int rent = 200;
double hour;
double totalrent;
System.out.println("Please enter the number of hours you would like to rent a room: ");
hour= in.nextDouble();
totalrent= rent * hour;
System.out.printf("Your total cost for renting a room is: $%3.0f\n", totalrent);
System.out.println("Enter number of guests for cost of dinner plates: ");
int plate = 40;
int guest;
int totalplate;
guest= in.nextInt();
totalplate= plate * guest;
System.out.printf("Your total cost for dinner plates is: $%d%n", totalplate);
System.out.println("Enter 'total' for grand total, which includes hourly rent, dinner, and band.");
System.out.println("Enter 'person' to get total for each person; dividing the grand total evenly.");
String.total = int total;
String.person = int person;
int band = 350;
int total;
total = band + totalplate + totalrent;
person = total/guest;
while(!String.total.equals("total") && !String.person.equals("person")) {
System.out.println("Please only enter 'total' or 'person'.");
if(input.equals("total")){
System.out.printf("Your grand total is: $%3.0f\n", total);
else if(input.equals("person")){
System.out.printf("Your total per person is: $%3.2f\n", person);
System.out.println("End of program");
}
}
}