I want this program written in JAVA with the algorithm(The step by step process for the...

90.2K

Verified Solution

Question

Programming

I want this program written in JAVA with the algorithm(The stepby step process for the problem) . Please help it is due in acouple of hours. I don't want the C++ program, I want it in JAVAplease

#20 Theater Ticket Sales

Create a TicketManager class and a program that uses it to selltickets for a single performance theater production.


Here are the specifications:
• The theater's auditorium has 15 rows, with 30 seats in each row.To represent the seats, the TicketManager class should have atwo-dimensional array of SeatStructures. Each of these structuresshould have data members to keep track of the seat's price andwhether or not it is available or already sold.
• The data for the program is to be read in from two files locatedin the Chapter 8 programs folder on this book's companion website.The first one, SeatPrices.dat, contains 15 values representing theprice for each row. All seats in a given row are the same price,but different rows have different prices. The second file,SeatAvailability. dat, holds the seat availability information. Itcontains 450 characters (15 rows with 30 characters each),indicating which seats have been sold (' • ') and which areavailable ( '#' ). Initially all seats are available. However, oncethe program runs and the file is updated, some of the seats willhave been sold. The obvious function to read in the data from thesefiles and set up the array is the constructor that runs when theTicketManager object is first created.
• The client program should be a menu-driven program that providesthe user with a menu of box office options, accepts and validatesuser inputs, and calls appropriate class functions to carry outdesired tasks. The menu should have options to display the seatingchart, request tickets, print a sales report, and exit theprogram.
• When the user selects the display seats menu option, aTicketManager function should be called that creates and returns astring holding a chart, similar to the one shown here. It shouldindicate which seats are already sold ( *) and which are stillavailable for purchase (#) . The client program should then displaythe string.

Seats 1234567890 12345678901234567890

Row 1 ***###***###******############

Row 2 ####*************####*******##

Row 3 **###**********########****###

Row 4 **######**************##******

Row 5 ********#####*********########

Row 6 ##############************####

Row 7 #######************###########

Row 8 ************##****############

Row 9 #########*****############****

Row 10 #####*************############

Row 11 #**********#################**

Row 12 #############********########*

Row 13 ###***********########**######

Row 14 ##############################

Row 15 ##############################
• When the user selects the request tickets menu option , theprogram should prompt for the number of seats the patron wants, thedesired row number, and the desired starting seat number. ATicketManager ticket request function should then be called andpassed this information so that it can handle the ticket request.If any of the requested seats do not exist, or are not available,an appropriate message should be returned to be displayed by theclient program. If the seats exist and are available, a stringshould be created and returned that lists the number of requestedseats, the price per seat in the requested row, and the total pricefor the seats. Then the user program should ask if the patronwishes to purchase these seats.
• If the patron indicates they do want to buy the requested seats ,a TicketManager purchase tickets module should be called to handlethe actual sale. This module must be able to accept money, ensurethat it is sufficient to continue with the sale, and if it is, markthe seat(s) as sold, and create and return a string that includes aticket for each seat sold (with the correct row, seat number, andprice on it).
• When the user selects the sales report menu option, aTicketManager report module should be called. This module mustcreate and return a string holding a report that tells how manyseats have been sold, how many are still available, and how muchmoney has been collected so far for the sold seats. Think about howyour team will either calculate or collect and store thisinformation so that it will be available when it is needed for thereport.
• When the day of ticket sales is over and the quit menu choice isselected, the program needs to be able to write the updated seatavailability data back out to the file. The obvious place to dothis is in the TicketManager destructor.

Answer & Explanation Solved by verified expert
4.4 Ratings (999 Votes)
Program code to copyAssignment8javaimport javautilpublic class Assignment8 public static void mainString args declare variables to controlmenu int usersChoice 0 Scanner scan newScannerSystemin declare and instantiate aTicketManager object TicketManager objectDone newTicketManager display menu printMenu do ask the user to choose a command SystemoutprintlnnPlease enter a command usersChoice scannextInt switchusersChoice case 1 just has to print the seats objectDonedisplaySeats break case 2 three variables seatsDesired rowDesiredstartingSeat int seatsDesired 0 int rowDesired 0 int startingSeat 0 asks the three respective questions SystemoutprintNumber of seats desired 1 30 seatsDesired scannextInt SystemoutprintnDesired row 1 15 rowDesired scannextInt SystemoutprintnDesired starting seat numberin the row 1 30 startingSeat scannextInt check if available ifobjectDonerequestTicketsseatsDesiredrowDesired startingSeat SystemoutprintlnThe seatsyou have requested are available for purchase else SystemoutprintlnUnfortunately the seats you have requested arenot available for purchase break Ask if they would like to buy store invariable answer char answer SystemoutprintDo you wish to purchase thesetickets YN answer scannextcharAt0 if yes print    See Answer
Get Answers to Unlimited Questions

Join us to gain access to millions of questions and expert answers. Enjoy exclusive benefits tailored just for you!

Membership Benefits:
  • Unlimited Question Access with detailed Answers
  • Zin AI - 3 Million Words
  • 10 Dall-E 3 Images
  • 20 Plot Generations
  • Conversation with Dialogue Memory
  • No Ads, Ever!
  • Access to Our Best AI Platform: Flex AI - Your personal assistant for all your inquiries!
Become a Member

Other questions asked by students