Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

java 1 program I want to get the answer in less than 80 minutes because there is a current exam using Intellij or jGRASP SAMPLE

image text in transcribed

java 1 program

I want to get the answer in less than 80 minutes because there is a current exam

using Intellij or jGRASP

SAMPLE INPUT/OUTPUT How many tickets do you want to buy? 3 Available tickets = 97 How many tickets do you want to buy? 6 Sorry. Maximum tickets to buy is 4. Question 2 (13 Points) Write a Java program to sell a limited number of cinema tickets. Each person can buy up to 4 tickets, where the number of available tickets is 100. Your program should do the following: 1. Prompt the user for the number of tickets to buy. 2. Display the number of remaining tickets. 3. Repeat the above steps until all tickets have been sold. 4. Display the total number of buyers. Invalid testing: (1) If the number of tickets to buy is negative or zero, then print an invalid message. (2) If the number of tickets to buy is more than 4, then print a message that the maximum tickets to buy is 4. (3) If the number of tickets to buy is more than the available tickets, then print a message that there are no enough tickets available. See sample input/output on the right side >> How many tickets do you want to buy? 4 Available tickets=2 How many tickets do you want to buy? 3 Sorry. Only 2 tickets are left. How many tickets do you want to buy? 2 Total number of buyers is 32

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

Automating Access Databases With Macros

Authors: Fish Davis

1st Edition

1797816349, 978-1797816340

More Books

Students also viewed these Databases questions

Question

=+ Who do you think is right? Why?

Answered: 1 week ago