Question: I am writing the following problem statement in JavaScript Script. This is what I have so far. Can I get some help fixing the code.

I am writing the following problem statement in JavaScript Script. This is what I have so far. Can I get some help fixing the code. I am using if/else/switch in my coding. Problem :

You have been hired by a concert hall to track the purchase of tickets. There are four different sections where people can sit: orchestra, floor, lower level and upper level. Orchestra seats are $50, floor seats are $40, lower level are $30 and upper level are $10.00. Strangely enough, a customer can only purchase seats one type of section (orchestra, floor, etc) per visit but they can order as many of those tickets as they want. Because of this constraint you want to ask the user which section they want and then how many tickets in that section. They also want an alert to pop up after the section and the number of tickets is input that shows the clerk how much money is collected. (ie if a person orders 5 orchestra seats it will tell them to collect $250). (Important: Your program is keeping a running total of each item, the person using this isn't adding them up and just giving you the total at the end of the day). At the end of the day a report is provided that will show something similar to the following example information (the numbers here just represent test data, any number of tickets in each section can happen: The total number of Orchestra tickets purchased:10 The total number of Floor Tickets purchased: 10 The total number of Lower Level tickets purchased: 10 The total number of Upper Level tickets purchased: 10 The total dollar amount for Orchestra tickets: $500.00 The total dollar amount for Floor Tickets : $400.00 The total dollar amount for Lower Level tickets: $300.00 The total dollar amount for Upper Level tickets: $100.00 The total amount of money collected: $1300.00 Comment This is what I have been able to do so far.

Assumptions

four type of seating types Orchestra seats = 50.00 Floor seats = 40.00 lower level seats = 30.00 upper level seats = 10.00 collect amount message

Input

section? (Orchestra/floor/lowerlevel/upperlevel) number of tickets

Calculations

if section = "Orchestra" then orchestraAccum = orchestraAccum + number of tickets section price = Orchestra seats enter message = "Collect:" + total dollar Amount else if section = "floor seats" then floorAccum = floorAccum + mumber of tickets section price = floor seats else if section = "lower level seats then lowerlevelAccum = lowerlevelAccum + number of tickets section price = lower level seats else if section = "upper level seats" then upperlevelAccum = upperlevelAccum + number of tickets section price = upper level seats

Total dollar amount = section price * number of tickets enter message = "Collect:" + total dollar Amount total dollar Amount for orchestra tickets = orchestraAccum * Orchestra seats total dollar Amount for floor ticket = floorAccum * floor seats total dollar Amount for lower level tickets = lowerlevelAccum * lower level seats total dollar Amount for upper level tickets = upperlevelAccum * upper level seats

Output

orchestraAccum Total number of Floor tickets purchased Total number of Lower Level tickets purchased Total number of Upper Level tickets purchased Total dollar amount for Orchestra tickets Total dollar amount for Floor tickets Total dollar amount for Lower Level ticket Total dollar amount for Upper Level tickets Total amount of Money Collected

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!