import java.util.Scanner; public class Steam{ public static void main(String[] args){ int i=0,j=0; Scanner input = new Scanner(System.in); double ac[]={3,5,1.5,2}; double a[] = new double[100]; String cont, choose; double pay=0, hour=0; do{ pay=0; System.out.println("Select the following: "); System.out.println("1. steam & sauna ($3)"); System.out.println("2. Massage ($5)"); System.out.println("3. Soft Drink ($1.5)"); System.out.println("4. Fast Food ($2)"); System.out.println("5. Payment"); System.out.println("6. Exit"); do{ System.out.print("Choose: "); choose=input.nextLine(); if(choose.equalsIgnoreCase("6")) break; if(choose.equalsIgnoreCase("1")){ a[0]=ac[0]; }else if(choose.equalsIgnoreCase("2")){ a[0]=0; System.out.print("Input hour(s): "); hour=input.nextDouble(); a[1]=ac[1]*hour; }else if(choose.equalsIgnoreCase("3")){ a[2]=ac[2]; }else if(choose.equalsIgnoreCase("4")){ a[3]=ac[3]; }else if(choose.equalsIgnoreCase("5")){ for(j=0; j<i; j++){ pay+=a[j]; a[j]=0; } System.out.println("\nTotal Payment: $"+ pay); break; } i++; }while(true); if(choose.equalsIgnoreCase("6")) break; System.out.print("Do you want to continue? (y/n): "); cont=input.nextLine(); }while(cont.equalsIgnoreCase("y")); } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)