Assignment Purpose The purpose of this lab is to write a well commented java program that demonstrates...

80.2K

Verified Solution

Question

Programming

Assignment Purpose

The purpose of this lab is to write a well commented javaprogram that demonstrates the use of two dimensional arrays, inputvalidation, and methods. (Write by Java Code, NeedComment)

Instructions

  1. A theater seating chart is implemented as a two-dimensionalarray of ticket prices, like this:

Seat Ticket Price

10 10 10 10 10 10 10 10 10 10

10 10 10 10 10 10 10 10 10 10

10 10 10 10 10 10 10 10 10 10

10 10 20 20 20 20 20 20 10 10

10 10 20 20 20 20 20 20 10 10

10 10 20 20 20 20 20 20 10 10

20 20 30 30 40 40 30 30 20 20

20 40 50 50 50 50 50 50 40 20

80 50 50 80 80 80 80 50 50 30

Seating Arrangement: Seats No.

1 2 3 4 5 6 7 8 9 10

11 12 13 14 15 16 17 18 19 20

21 22 23 24 25 26 27 28 29 30

31 32 33 34 35 36 37 38 39 40

41 42 43 44 45 46 47 48 49 50

51 52 53 54 55 56 57 58 59 60

61 62 63 64 65 66 67 68 69 70

71 72 73 74 75 76 77 78 79 80

81 82 83 84 85 86 87 88 89 90

  1. Write a program that prompts the user to pick a price. When auser specifies a price, make sure it is available. Mark sold seatsby changing the price to 0. You will write at least 3 methods.
    1. One method that reads, validates and returns the price.
    2. The other that checks whether a seat is available thatprice.
    3. The third method prints a confirmation if the seat is availableor prints a message saying “A seat at this price is not available.Good Bye.”

Hint: Basically, you will search the 2D array for theinput price, and as soon as you find a matching price, you willreplace the price at that location with a 0.

Sample output 1

Please pick a price or press Q to quit: 80

      Checking for theavailability……

      Your seat is confirmed! Your seatnumber is 81. Enjoy your movie

Please pick a price or press Q to quit: 80

      Checking for theavailability……

      No seat at this price isavailable. Sorry!

Please pick a price or press Q to quit: Q
     Thank you for using our online ticketingservice. Goodbye!

Sample output 2

Please pick a price or press Q to quit: 10

      Checking for theavailability……

      Your seat is confirmed! Your seatnumber is 1. Enjoy your movie

Please pick a price or press Q to quit: 20

      Checking for theavailability……

      Your seat is confirmed! Your seatnumber is 33. Enjoy your movie

Please pick a price or press Q to quit: 20

      Checking for theavailability……

      Your seat is confirmed! Your seatnumber is 34. Enjoy your movie

      Please pick a price or press Q toquit: 200

      Please pick a valid price. Validprices are $10, $20, $30, $40, $50, and $80

Please pick a price or press Q to quit: Q

Thank you for using our online ticketing service. Goodbye!

Answer & Explanation Solved by verified expert
4.1 Ratings (678 Votes)
Code to copy along with screenshots of code andoutput are providedPlease refer to screenshots to understand the indentation ofcodeIf you have any doubts or issues Feel free to ask incommentsPlease give this answer a like or upvote This will be veryhelpful for meScreenshots of Code Screenshots of Output Code    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