subject

Write a program that determine the admission price for a person to attend the sectionals game. Any day prior to game day, adult tickets cost $10, and student tickets cost $6. On game day, the cost of each ticket goes up by $1. People with a coupon can get a discount. Anyone with coupon code CHS2021 gets a 5% discount, and anyone with coupon code CHSVIP gets a 10% discount. This program should have 3 functions: askUser: This function asks the user all of the important questions (adult or student, game day or not, if they have a coupon or not and if so what the code is). This function takes in NO parameters and returns NO values. This function updates 4 global variables: status ("a" or "s" for adult or student), gameDay (True or False), hasCoupon (True or False), and coupCode ("CHS2021" or "CHSVIP").
getCost: This function takes in two parameters: string st (for status "a" or "s") and boolean gd (for game day True or False). Based on the inputted values, it calculates and returns one integer value, cost.
getDiscount: The function takes in two parameters: coup (coupon code, "CHS2021" or "CHSVIP" ) and c (cost). The function should only be called if hasCoupon is True. The function calculates and returns one decimal (float) value for the new discounted cost, discCost.

Example output:
Are you a student or adult (enter s or a)? a
Is this for a game today? no
Do you have a coupon? yes
What is the code? CHS2021
Your cost is: $9.5

Press enter to exit
Are you a student or adult (enter s or a)? s
Is this for a game today? yes
Do you have a coupon? no
Your cost is: $7.0

Press enter to exit

ansver
Answers: 3

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 19:20, bob4059
1)consider the following code snippet: #ifndef book_h#define book_hconst double max_cost = 1000.0; class book{public: book(); book(double new_cost); void set_cost(double new_cost); double get_cost() const; private: double cost; }; double calculate_terms(book bk); #endifwhich of the following is correct? a)the header file is correct as given. b)the definition of max_cost should be removed since header files should not contain constants. c)the definition of book should be removed since header files should not contain class definitions. d)the body of the calculate_terms function should be added to the header file.
Answers: 1
image
Computers and Technology, 25.06.2019 00:30, kukisbae
How do i take a screenshot on a laptop?
Answers: 2
image
Computers and Technology, 25.06.2019 08:30, aj12381
Which of the following terms is described as “the art and design of using text”? a. typography b. elements of design c. typos d. graphic design
Answers: 1
image
Computers and Technology, 25.06.2019 22:20, aliviafrancois2000
Question 2 of 40 3 points which of the following tasks is the project manager least likely to be involved in? ) a. monitoring the budget o b. defining the project scope o c. documenting important project changes o d. running project meetings
Answers: 1
You know the right answer?
Write a program that determine the admission price for a person to attend the sectionals game. Any d...

Questions in other subjects:

Konu
Mathematics, 16.11.2019 00:31
Konu
Social Studies, 16.11.2019 00:31
Konu
Mathematics, 16.11.2019 00:31