1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Oduvanchick [21]
4 years ago
5

Write an application to pre-sell a limited number of theatre tickets. Each buyer can buy as many as 6 tickets. No more than 178

tickets can be sold. Implement a program called TikStar that prompts the user for the desired number of tickets and displays the number of remaining tickets. Repeat until all tickets have been sold, and then display the total number of buyers.
Computers and Technology
1 answer:
Serjik [45]4 years ago
8 0

Answer:

THe required code is given below:

Explanation:

import java.util.Scanner;

public class TicketSeller {

public static int count=0;

public static void main(String[] args) {

Scanner scanner = new Scanner(System.in);

 

int order; //number of ticket ordered

int numberTickets; //total number of available tickets

System.out.println("Input the number of tickets you want to sell: ");

numberTickets = scanner.nextInt();

//continue until there are no tickets remaining

while (numberTickets>0)

{

System.out.println("\nInput requested tickets: ");

order = scanner.nextInt();

if (order<=numberTickets) //check if the ordered number is less than(or equal to) the available tickets

{

numberTickets= processOrder(order,numberTickets);

count++; //increase the count of number of buyers

}

else System.out.println("Too many tickets requested, please try again.");

}

System.out.println("You have had "+count+ " buyers.");

}

public static int processOrder(int order, int numberTickets){

Scanner scanner = new Scanner(System.in);

if(order>4) //check if order is more than 4

{

System.out.println("Too many tickets requested, please try again.");

System.out.println("\nInput requested tickets: "); //ask to input number of tickets again

order = scanner.nextInt();

numberTickets= processOrder(order,numberTickets);

count++; //increase the count of number of buyers

 

}

else

{

numberTickets=numberTickets-order; //subtract the number of ordered tickets from available tickets

System.out.println("Thank you for your purchase. There are "+numberTickets+ " tickets remaining.\n");

}

 

return numberTickets;

}

You might be interested in
Why did LISD had to block the game “among us”?
frosja888 [35]
Lewisville Independent School District blocked the following program: Among Us because the game was a distraction to online education. Normally, school districts disable/block games that students play to make sure they are not just playing games and that they are paying attention during class.
3 0
3 years ago
Read 2 more answers
_____ interviews rely on scenarios and reflections to evaluate an applicant’s skill set.
ra1l [238]
I think its behavioral
4 0
3 years ago
Read 2 more answers
A customer would like you to install a high-end video card suitable for gaming. Your installation and configuration SHOULD inclu
Snowcat [4.5K]

Answer: • Ensure that the video card is compatible with the expansion slot

• Install video drivers from CD and then install updated drivers from the internet

• Configure the PC to use the integrated graphics if available and needed

Explanation

Your question isn't complete as you didn't put the options but I got the options online and the correct answers have been provided.

The installation and configuration for the high-end video card suitable for gaming will include:

• Ensure that the video card is compatible with the expansion slot

• Install video drivers from CD and then install updated drivers from the internet

• Configure the PC to use the integrated graphics if available and needed

4 0
3 years ago
Answer all of the questions,
Phantasy [73]

Answer:

sry but I don't know the answer

5 0
3 years ago
Which piece of personal information do websites often require users to enter?
Tatiana [17]
<h2>Answer: <u><em>The most common type of information that a website will ask you for is a password, which is unique to that site. Eye color is irrelevant for sites since there are only about 5 possible colors for human eyes. Most of the time there is no practical use for that information.</em></u></h2>

Explanation:

<h2><u><em>Hope this helps</em></u></h2>
7 0
4 years ago
Read 2 more answers
Other questions:
  • There are two activities on your schedule, which are: 1) install server in lab 2) move server into the data center. however, the
    6·1 answer
  • Properly defined the primary part of a CPU​
    5·1 answer
  • Clep allows students to do all of thw following except which?
    11·2 answers
  • You manage an NLB cluster composed of three servers: Server1, Server2 and Server3. Your maintenance schedule indicates that Serv
    15·1 answer
  • A virus is a self-replicating program that produces its own code by attaching copies of it into other executable codes.
    7·1 answer
  • Discussion Six: Code of Ethics IT workers have many different relationships, including those with employers, clients, suppliers,
    7·1 answer
  • What devices gives input​
    5·1 answer
  • Write a program that will read two floating point numbers (the first read into a variable called first and the second read into
    13·1 answer
  • What is the outcome when a floating-point number is divided by zero?
    12·1 answer
  • Electronic evidence on computer storage media that is not visible to the average user is called​ ________.
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!