Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

//In Class Activity Starting File //Program ID : TicketPrice.java //Author : Student name //Date Written : Today's date //Class : CSC110AA and CIS163AA //Brief Description:

image text in transcribed

//In Class Activity Starting File //Program ID : TicketPrice.java //Author : Student name //Date Written : Today's date //Class : CSC110AA and CIS163AA //Brief Description: // This program determines ticket price based on age. Uses an if..else if package ch4; import java.util.Scanner; public class TicketPrice { public static void main(String[] args) { int age = 0; double price = 0.0; Scanner scan = new Scanner(System.in); System.out.println( "Movie Ticket Price Calculator"); System.out.print( "Full Ticket price: "); price = scan.nextDouble(); System.out.print( "Your age: "); age = scan.nextInt(); //calculate the ticket prices and display a message // based on your if..else if..else statement } }
Download TicketPrice.java. Complete the program to display movie prices based on the following kids 5 and under are free students 6 to 20 pay half price adults 21 and older pay full price Example Output: Movie Ticket Price Calculator Full Ticket price: 9.55 Your age: 19 You pay half price. Your ticket price is $4.78 Good bye! ****Bonus 1 ****. Instead of prompting the user for the ticket price, randomly generate an integer for the full ticket price range 7 - 14 Example Output Bonus 1: Movie Ticket Price Calculator Generated Full Ticket price: 10.0 Your age: 19 You pay half price. Your ticket price is $5.00 Good bye! **** Bonus 2****. Instead of prompting the user for the ticket price, randomly generate a double for the full ticket price in the range 7.0 - 13.99999999...... Example Output Bonus 2: Movie Ticket Price Calculator Generated Full ticket price : 13.901696585241256 Your age: 19 You pay half price. Your ticket price is $6.95

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

Relational Database And SQL

Authors: Lucy Scott

3rd Edition

1087899699, 978-1087899695

More Books

Students also viewed these Databases questions

Question

Provide examples of KPIs in Human Capital Management.

Answered: 1 week ago

Question

What are OLAP Cubes?

Answered: 1 week ago