There are three seating categories at a stadium. For a

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()

 

Leave a Comment

Your email address will not be published. Required fields are marked *

GradeEssays.com
We are GradeEssays.com, the best college essay writing service. We offer educational and research assistance to assist our customers in managing their academic work. At GradeEssays.com, we promise quality and 100% original essays written from scratch.
Contact Us

Enjoy 24/7 customer support for any queries or concerns you have.

Phone: +1 213 3772458

Email: support@gradeessays.com

© 2024 - GradeEssays.com. All rights reserved.

WE HAVE A GIFT FOR YOU!

15% OFF 🎁

Get 15% OFF on your order with us

Scroll to Top