Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

How to complete the MovieTheater program below that prompts the user for the number of adult and child tickets to purchase as well as whether

  • How to complete the MovieTheater program below that prompts the user for the number of adult and child tickets to purchase as well as whether the movie showing is a matinee. Adult tickets cost $12 and child tickets cost $10. There is a $3 discount for each matinee ticket.

public class MovieTheater {

public static final int ADULT_PRICE = 12;

public static final int CHILD_PRICE = 10;

public static final int MATINEE_DISCOUNT = 3;

public static void main(String[] args) {

}

}

  • Prompt the user for the number of each type of ticket. Output "Invalid value" and exit the program if either number of tickets is less than 0.
  • Prompt the user for whether the movie is a matinee. If the user enters anything that starts with y or Y, it is a matinee. Otherwise, it is not a matinee.
  • Output the price of the tickets formatted as $xx.00 as shown in the examples below. This can be done by simply using String concatenation - you don't need to use printf().
  • Provide "javadoc" for the class, main method, and class constants.
  • See the TaxCalculator program for an example of how to complete the program and document it using javadoc comments.

$ java MovieTheater

Adult tickets: 2

Child tickets: 3

Matinee (y,n): n

Ticket price: $ 54.00

$ java MovieTheater

Adult tickets: 0

Child tickets: 5

Matinee (y,n): yes

Ticket price: $ 35.00

$ java MovieTheater

Adult tickets: -4

Invalid value

Step by Step Solution

There are 3 Steps involved in it

Step: 1

Heres the completed MovieTheater program with your requirements and documentation java public class MovieTheater Adult ticket price in dollars public static final int ADULTPRICE 12 Child ticket price ... 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_2

Step: 3

blur-text-image_3

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

Programming Logic & Design Comprehensive

Authors: Joyce Farrell

9th edition

978-1337102070

More Books

Students also viewed these Programming questions

Question

What is the purpose of a Notice of Assessment?

Answered: 1 week ago