Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Java Question Question 1 - Scanner class user input and if statement practice Pete at Petes Petting Zoo wants a program to work out what

Java Question Question 1 - Scanner class user input and if statement practice Pete at Petes Petting Zoo wants a program to work out what to charge groups of visitors to his childrens zoo. An adults ticket costs $10, a childs ticket cost $5 and a family ticket (for 2 adults and 2 children) costs $26. The program must ask the user to enter the number of adults and the number of children in the group and display to screen the cheapest selection of tickets and the total cost. A sample execution of the program is shown here. Note, if no tickets are required of a particular type no output is given for that ticket type.

Names Data Types
adultTicket Integer
cost Integer
childTicket Integer
familyTickets Integer
numberAdult Integer
numberChildren Integer

I.e.

Number of adults: 2

Number of children: 4

Number of family tickets: 1

Number of child tickets: 2

Total cost: $36

Run the program with the following above examples

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

3. What are potential solutions?

Answered: 1 week ago