Question: There are three seating categories at a stadium. For a softball game, Class A seats cost $15, Class B seats cost $12, and Class C

There are three seating categories at a stadium. For a softball game, Class A seats cost $15, Class B seats cost $12, and Class C seats cost $9.

Design a modular program that asks how many tickets for each class of seats were sold, and then displays the amount of income generated from ticket sales.

You will only write the javascript for the assignment as the pseudocode will be provided for you in this repl.it:

Function main() // get number of tickets for each class Integer classATickets = getTicketsForClass("A") Integer classBTickets = getTicketsForClass("B") Integer classCTickets = getTicketsForClass("C")

// get income for each ticket class Integer classAIncome = calculateIncome(classATickets,15) Integer classBIncome = calculateIncome(classBTickets,12) Integer classCIncome = calculateIncome(classCTickets,9)

Integer total = classAIncome + classBIncome + classCIncome Display "Total income: " + total End Function

Function getTicketsForClass(String letter) Display "How many tickets for class " + letter + " seats?" Integer ticketCount = Input return ticketCount End Function

Function calculateIncome(Integer ticketCount, Float ticketCost) return ticketCount * ticketCost End Function

// call main to start program main()

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 Databases Questions!