Question
Draw flowchart loop Scanner sc = new Scanner(System.in); int visitorCounter = 1; char count = 'N'; while (true) { System.out.println(******VISITOR + visitorCounter + *******);
Draw flowchart loop
Scanner sc = new Scanner(System.in); int visitorCounter = 1; char count = 'N';
while (true) { System.out.println("******VISITOR " + visitorCounter + "*******");
System.out.print("Enter your nationality: "); char nationality = sc.next().charAt(0);
System.out.print("Choose category of visitor (A- Adult, C - Children, S - senior): "); char category = sc.next().charAt(0);
System.out.print("Number of tickets: "); int numTickets = sc.nextInt();
double entranceFee = 0.0; if (nationality == 'M') { if (category == 'A') { entranceFee = 43.0 * numTickets; } else if (category == 'C') { entranceFee = 16.0 * numTickets; } else if (category == 'S') { entranceFee = 21.0 * numTickets; } } else if (nationality == 'F') { System.out.print("From which part? (I- Kad/Working Permit/Dependent Pass, E- Asean, O - Others):"); char subCategory = sc.next().charAt(0); if (subCategory == 'I') { if (category == 'A') { entranceFee = 50.0 * numTickets; } else if (category == 'C') { entranceFee = 25.0 * numTickets; } else if (category == 'S') { entranceFee = 50.0 * numTickets; } } else if (subCategory == 'E') { if (category == 'A') { entranceFee = 61.0 * numTickets; } else if (category == 'C') { entranceFee = 33.0 * numTickets; } else if (category == 'S') { entranceFee = 61.0 * numTickets; } } else if (subCategory == 'O') { if (category == 'A') { entranceFee = 82.0 * numTickets; } else if (category == 'C') { entranceFee = 43.0 * numTickets; } else if (category == 'S') { entranceFee = 82.0 * numTickets; } } } System.out.println("Visitor Type " + category + " Charge " + entranceFee);
System.out.print("Buy other ticket (Y/N)?: "); count = sc.next().charAt(0); }
} }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started