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
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
postnew [5]

Answer: 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40

Explanation: x1

8 0
3 years ago
a document contains a list of items that appear in no particular order. what is the best way to format the list
krok68 [10]

Answer:

bulleted list

Explanation:

8 0
3 years ago
Which of the following occupations is the most likely o require working weekends and night shifts
Juliette [100K]
What are the choices?
5 0
3 years ago
Read 2 more answers
Help
photoshop1234 [79]

Answer:

206.25.

Explanation:

The equation to find out how much money you will make is prt, or principle • rate • time.

So you do 25 x 2.75% x 25, which is equal to 206.25.

4 0
3 years ago
Accenture is one of several hundred companies that has signed on to the united nations global compact (ungc) business ambition p
DIA [1.3K]

Accenture goal of this pledge is to  to keep global warming below a 1.5 Celsius increase from pre-industrial levels.

<h3>What is Accenture most known for?</h3>

Accenture is known to be a body that is said to have a lot of range of service that they do offer such as strategy, management, digital, technology, and others.

Note that Accenture is said to be a global body that help in the area of security as well as others.

Therefore, based on the above Accenture goal of this pledge is to  to keep global warming below a 1.5 Celsius increase from pre-industrial levels.

Learn more about Accenture from

brainly.com/question/25682883

See full question below

Accenture is one of several hundred companies that has signed on to the United

Nations Global Compact (UNGC) Business Ambition pledge.

What is the goal of this pledge?

O to reverse all effects of global warming within the next decade

O to keep global warming below a 1.5 Celsius increase from pre-industrial levels

O to donate to charity in exchange for exemption from regulations

O to switch entirely to solar power at all office locations worldwide

8 0
2 years ago
Other questions:
  • A tablet computer is a low-cost, centrally managed computer with no internal or external attached drives for data storage.
    10·1 answer
  • p25: File Write and Read1) User enters a file name (such as "myMovies.txt").2) User enters the titles of 4 of their favorite mov
    12·1 answer
  • If a variable uses more than one byte of memory, for pointer purposes its address is: Group of answer choices the address of the
    12·1 answer
  • Hide Time Remaining A
    11·1 answer
  • We cannot imagine a life without the Internet. Imagine that you had to live without being connected to the Internet. Discuss the
    9·1 answer
  • X= [12,67,89,34,56,90,67]
    6·1 answer
  • Discuss TWO changes in ICMP that took place with the development of IPV6 and indicate why those changes were made.
    7·1 answer
  • MODERATOR DELETE MY ACC
    8·2 answers
  • How do i copy a canvas course from old class to new course.
    12·1 answer
  • 8. Give regular expressions with alphabet {a, b} for
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!