Question: topic 6 more decisions conditionalswitch requirements for chapter 6 zylab...
Topic 6: More Decisions: conditional/switch Requirements for chapter 6 zyLab Full Program: Extend Decisions Program for writing Java programming
The local concert venue you wrote the program for in Topic 5 would like you to modify the program to handle an extended options.
Topic 5 can be found below.
In addition to concert events, the venue has added DJ dancing events.
o Concerts tickets will now cost:
44.00 each, if fewer than 10 tickets are purchased together
40.00 each, if 10 or more tickets are purchased together o DJ dancing tickets will cost:
25.00 each, if fewer than 10 tickets are purchased together
20.00 each, if 10 or more tickets are purchased together
The seating options have also been expanded. Choice are now:
o Floor tickets for free o Bleacher-type open seating for an additional $4.99 each o Reserved row seats for an additional $9.99 each o Reserved seats at a table for an additional $15.99 each
T-shirts will now be priced according to how many are purchased, as follows: o $22.95 per shirt for 1 – 5 shirts o $21.25 per shirt for 6 – 12 shirts o $19.00 per shirt for more than 12 shirts
(1) Again, the program must use constants for ALL fixed prices, and for the ticket count and t-shirt count discount thresholds (so there should be no hardcoded numbers in the program calculations).
Create the necessary constants (and remove old constants that no longer apply to the program) Read all the inputs from the users, after creating appropriate variables to hold each answer. Inputs are:
Whether the customer wants tickets for (1) a concert or (2) a DJ dancing event. o After reading the user input, assign a value to a String variable that will hold a String description of the event type chosen (concert or DJ dancing).
The number of tickets (include the customer’s event type in the prompt)
What kind of seating the customer wants o Display a menu of choices to the user. o After reading the user input, assign a value to a String variable to hold a description of the seating chosen (floor, bleachers, row seat, or table)
How many T-shirts to include
(2) Tests 1 – 3 Display 2 blank lines after reading all inputs. Then display an order summary.
All order details should line up on the right with the last character in position 35.
The event type should be displayed as the String description (not a number).
The seating type should be displayed as the String description (not a letter).
Only display the number of t-shirts ordered when the customer has actually ordered t-shirts. Otherwise, do not display the t-shirt order line
(3) Tests 4 – 7 Calculate the bill information, including the total, using decisions to determine:
Cost per ticket
Cost per seat
Cost per t-shirt Display a blank line. Then display the bill information, lined up on the right, ending at position 35, just like the order information above. All of the costs will still be under $10,000.00.
Use decisions to control the following: o Do not display the seating cost, if the seating cost is 0 (i.e. floor). o Do not display the t-shirt cost, if t-shirt cost is 0 (i.e. no t-shirts were ordered). o Do not display the dividing line and total cost if there is ONLY a ticket cost (i.e. seating and t-shirt costs were both 0). This means that you will display only the ticket cost if there are no other costs.
(4) Test 8 When the user enters anything other than f/F/b/B/r/R/t/T for the seating type
Display the error message: Invalid choice - floor will be used
Adjust the seating type accordingly
(5) Tests 9 & 10 To prevent scalping of concert tickets, no more than 25 concert tickets will be sold together (but there is no limit on DJ dancing tickets).
Create a constant to hold the limit for concert tickets (25).
After reading the number of tickets user input, decide whether the number of tickets purchased is valid, as follows: o When a user tries to buy more than 25 concert tickets:
Display an error message that includes the defined constant, saying that the order will be adjusted to the maximum allowed.
Adjust the number of tickets accordingly.
Tests 11 & 12 To prevent “coding to the tests”, the last tests in this zyLab are blind test. You will not be shown the inputs or outputs – the test platform will only tell you if you passed or failed the tests. If the previous code was written correctly, your program should also pass these tests.