Question: / this is required for capturing user input ; public class Main { public static void main ( String [ ] args ) { /

/this is required for capturing user input
;
public class Main
{
public static void main(String[] args)
{
//STEP 1- INPUT
Scanner scanner = new (System.in);
//1) ask the user for their satisfaction level (Dissatisfied, Satisfied, Extremely Pleased)
("Enter satisfaction level (1= Dissatisfied, 2= Satisfied, 3= Extremely
Pleased): ");
int satisfactionLevel = scanner.nextInt();
//2) ask the user for the number of people in the dinner party
System.out.print("Enter number of people in the dinner party: ");
numberPeople =();
//3) ask the user for the total cost of bill (before tip & tax)
System.out.print("Enter total cost of bill (before tip & tax): ");
totalCostBillBeforeTaxTip =();
//STEP 2- PROCESS (Calculate):
//1) Calculate the TIP AMOUNT of TOTAL COST BILL based on SATISFACTION LEVEL
//Calculate TIP AMOUNT of TOTAL COST BILL
tipAmountOfTotalCostBill =0.0;
//if the customers are Dissatisfied
if(satisfactionLevel ==1)
{
tipAmountOfTotalCostBill = totalCostBillBeforeTaxTip *0.15;
}
//if the customers are Satisfied
if(satisfactionLevel ==)
{
tipAmountOfTotalCostBill = totalCostBillBeforeTaxTip * ;
}
//if the customers are Extremely Pleased
if(==3)
{
= totalCostBillBeforeTaxTip *0.25;
}
//2) Calculate the TAX based on TOTAL COST BILL
tax = totalCostBillBeforeTaxTip *0.07;
//3) Calculate the TAX based on TOTAL COST BILL (NJ Sales Tax Rate =7%)
totalCostBill = totalCostBillBeforeTaxTip + tax +
tipAmountOfTotalCostBill;
//4) Calculate how much each person should pay (including TIP & TAX)
totalCostPerPerson = totalCostBill / numberPeople;
//STEP 3- OUTPUT
//1) Display the TOTAL COST of the BILL (before tip & tax)
("Total Cost of Bill (before tip & tax): $"+ totalCostBillBeforeTaxTip);
//2) Display the TAX AMOUNT
("Tax Amount: $"+ tax);
//3) Display the TIP AMOUNT
("Tip Amount: $"+ tipAmountOfTotalCostBill);
//4) Display the TOTAL BILL (including tip & tax)
("Total Bill (including tip & tax): $"+ totalCostBill);
//5) Display the COST PER PERSON
System.out.println(": $"+ totalCostPerPerson);
}
}
/ this is required for capturing user input ;

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!