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]
3 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]3 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
Which avenue may utilize video streaming, audio narration, print designs and animation?
Shtirlitz [24]

Answer:

Multimedia avenue.

Explanation:

A file type is the standard used to store data such as pictures, texts, videos, and audios. All file types have unique file extension that determine which program to use to open a particular file and to access its data e.g pictures (jpeg, png), texts (txt, docx, rtf), videos (mp4, 3gp, avi), audios (mp3, acc).

Sometimes, computer users make the mistake of opening files with the wrong software application or program, this often leads to an error due to the incompatibility of the software application with the particular file.

Basically, all software applications are designed and developed for use with specific file extensions or formats and as such, when used to open a file it isn't developed for, it result in an error.

A multimedia avenue refers to a channel that is designed and developed to accept, utilize and combine various file formats such as audio, video, text, animation effects, etc. A common example of a multimedia avenue is Microsoft PowerPoint software.

Hence, the multimedia avenue may utilize video streaming, audio narration, print designs and animation.

8 0
3 years ago
What are some tasks for which you can use the VBA Editor? i need help for my computer class.
Murljashka [212]

Answer:

Visual Basic for Applications runs as an internal programming language in Microsoft Office applications such as Access, Excel, PowerPoint, Publisher, Word, and Visio. VBA allows users to customize beyond what is normally available with MS Office host applications by manipulating graphical-user-interface (GUI) features such as toolbars and menus, dialogue boxes, and forms. You may use VBA to create user-defined functions (UDFs), access Windows application programming interfaces (APIs), and automate specific computer processes and calculations. Macros can automate just about any task—like generating customized charts and reports, and performing word- and data-processing functions. Programmers,like replicating large pieces of code, merging existing program functions, and designing specific languages. VBA can also work in non-Microsoft settings by using a technology called "COM interface," which allows commands to interact across computer boundaries. Many firms have implemented VBA within their own applications, both proprietary and commercial, including AutoCAD, ArcGIS, CATIA, Corel, raw, and SolidWorks.

<em>(Hope this helps/makes sense!)</em>

6 0
3 years ago
Two communicating devices are using a single-bit even parity check for error detection. The transmitter sends the byte 10101010
icang [17]

Answer:

The receiver will not detect the error.

Explanation:

The byte sent by transmitter: 10101010

The byte received by receiver due to channel noise: 10011010

If you see the bold part of the both sent and received bytes you can see that the number of bits changed is 2.

The two communicating devices are using a single-bit even parity check. Here there are two changed bits so this error will not be detected as this single bit even parity check scheme has a limit and it detects the error when the value of changed bit is odd but here it is even.

This parity scheme basically works well with the odd number of bit errors.

7 0
3 years ago
Users report that the database on the main server cannot be accessed. A database administrator verifies the issue and notices th
navik [9.2K]

Answer: (C) Ransomware

Explanation:

The ransomware is one of the type of malware software design which is used for blocking the user accessing unauthorized and also without paying money.

The most of the ransomware software encrypt the computer accessing and the files as they demand for the payment dues for again restoring the access.  

It also encrypt the user account and the information until the correct decrypt key are get entered into the system. So, according to the given situation, the ransomware attack are experienced in an organization.  

Therefore, Option (C) is correct.

4 0
3 years ago
Exercise 3.16.4: Happy Face Solita
enot [183]

first do a happy face and a circule thats it

7 0
3 years ago
Other questions:
  • The ____ function displays the highest value in a range.
    15·2 answers
  • What technology allows data to be stored in one place and be retrieved by many systems?
    7·1 answer
  • Write the execution steps if the input is a lion.
    11·1 answer
  • Provide examples of the cost of quality based on your own experiences
    14·1 answer
  • Mobile app designers who work for themselves are often dubbed _____.
    10·1 answer
  • Many commercial encryption programs use a technology called ____, which is designed to recover encrypted data if users forget th
    12·1 answer
  • What are the three uses of a screw?​
    13·2 answers
  • Imagine a machine that produces an output force that is five times larger
    11·1 answer
  • Pls paanswer asap......​
    10·1 answer
  • ______ is used to extract knowledge from sources of data-NoSQL databases, Hadoop data stores, and data warehouses-to provide dec
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!