C++ HELP!!! We had a test yesterday and I got a lower grade than what I wanted. I would like to know how other people would solve this as my professor told me that what I did was incorrect, but did not specify how it was incorrect. If anyone can help me with this C++ test, I'd really appreciate it. C++ test: Write a program to determine total price and discounts for movie goers. // sample output (all in C++) /****************************** Enter how many movie goers: 4 Enter movie goer 1's age: 5 Enter movie goer 2's age: 25 Enter movie goer 3's age: 26 Enter movie goer 4's age: 57 The price for 4 movie goers is $54.00 There are 2 discounts. Goodbye /******************************/ Instructions Outside of the main function Declare a global integer constant named CHILD with a value of 5 Declare a global integer constant named SENIOR with a value of 55 Declare a global double constant named PRICE with a value of 15.0 Declare a global double constant named DISCOUNT with a value of 3.0 Define a bool function named IsDiscount that has one integer parameter named age. In the body, if age is less that or equal to CHILD or greater than or equal to SENIOR, return true, otherwise, return false. Define a void function named CalcTotal that has three parameters: an integer named age, a double named total, and an integer named discounts. The last two are passed by reference. The body of CalcTotal will determine if a discount is needed by calling your IsDiscount function. Increase total by the appropriate amount, either PRICE, or PRICE minus DISCOUNT. Also, increase discounts if necessary. Define an integer function named GetAge with one integer parameter named movie_goer. In the body, ask for the movie goer’s age (see sample output) and return the age. The main function Declare whatever variables you need and prompt the user for how many movie goers. Write a loop and call GetAge, and CalcTotal. Output the total price for the number of movie goers – format your output (see sample output). Output the number of discounts. Output “Goodbye”. Notes: Be sure you identify which movie goer’s age to enter, e.g. movie goer 1's age, or movie goer 2's age ... Be sure to include two decimal places wth the price that you output.
C++ HELP!!! We had a test yesterday and I got a lower grade than what I wanted. I would like to know how other people would solve this as my professor told me that what I did was incorrect, but did not specify how it was incorrect. If anyone can help me with this C++ test, I'd really appreciate it. C++ test: Write a program to determine total price and discounts for movie goers. // sample output (all in C++) /****************************** Enter how many movie goers: 4 Enter movie goer 1's age: 5 Enter movie goer 2's age: 25 Enter movie goer 3's age: 26 Enter movie goer 4's age: 57 The price for 4 movie goers is $54.00 There are 2 discounts. Goodbye /******************************/ Instructions Outside of the main function Declare a global integer constant named CHILD with a value of 5 Declare a global integer constant named SENIOR with a value of 55 Declare a global double constant named PRICE with a value of 15.0 Declare a global double constant named DISCOUNT with a value of 3.0 Define a bool function named IsDiscount that has one integer parameter named age. In the body, if age is less that or equal to CHILD or greater than or equal to SENIOR, return true, otherwise, return false. Define a void function named CalcTotal that has three parameters: an integer named age, a double named total, and an integer named discounts. The last two are passed by reference. The body of CalcTotal will determine if a discount is needed by calling your IsDiscount function. Increase total by the appropriate amount, either PRICE, or PRICE minus DISCOUNT. Also, increase discounts if necessary. Define an integer function named GetAge with one integer parameter named movie_goer. In the body, ask for the movie goer’s age (see sample output) and return the age. The main function Declare whatever variables you need and prompt the user for how many movie goers. Write a loop and call GetAge, and CalcTotal. Output the total price for the number of movie goers – format your output (see sample output). Output the number of discounts. Output “Goodbye”. Notes: Be sure you identify which movie goer’s age to enter, e.g. movie goer 1's age, or movie goer 2's age ... Be sure to include two decimal places wth the price that you output.
Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
Related questions
Question
C++ HELP!!!
We had a test yesterday and I got a lower grade than what I wanted. I would like to know how other people would solve this as my professor told me that what I did was incorrect, but did not specify how it was incorrect. If anyone can help me with this C++ test, I'd really appreciate it.
C++ test:
Write a program to determine total price and discounts for movie goers.
// sample output (all in C++)
/******************************
Enter how many movie goers: 4
Enter movie goer 1's age: 5
Enter movie goer 2's age: 25
Enter movie goer 3's age: 26
Enter movie goer 4's age: 57
The price for 4 movie goers is $54.00
There are 2 discounts.
Goodbye
/******************************/
Instructions
Outside of the main function
// sample output (all in C++)
/******************************
Enter how many movie goers: 4
Enter movie goer 1's age: 5
Enter movie goer 2's age: 25
Enter movie goer 3's age: 26
Enter movie goer 4's age: 57
The price for 4 movie goers is $54.00
There are 2 discounts.
Goodbye
/******************************/
Instructions
Outside of the main function
Declare a global integer constant named CHILD with a value of 5
Declare a global integer constant named SENIOR with a value of 55
Declare a global double constant named PRICE with a value of 15.0
Declare a global double constant named DISCOUNT with a value of 3.0
Define a bool function named IsDiscount that has one integer parameter named age.
In the body, if age is less that or equal to CHILD or greater than or equal to SENIOR, return true, otherwise, return false.
Define a void function named CalcTotal that has three parameters: an integer named age, a double named total, and an
integer named discounts. The last two are passed by reference.
The body of CalcTotal will determine if a discount is needed by calling your IsDiscount function. Increase total by the
appropriate amount, either PRICE, or PRICE minus DISCOUNT. Also, increase discounts if necessary.
Define an integer function named GetAge with one integer parameter named movie_goer.
In the body, ask for the movie goer’s age (see sample output) and return the age.
Declare a global integer constant named SENIOR with a value of 55
Declare a global double constant named PRICE with a value of 15.0
Declare a global double constant named DISCOUNT with a value of 3.0
Define a bool function named IsDiscount that has one integer parameter named age.
In the body, if age is less that or equal to CHILD or greater than or equal to SENIOR, return true, otherwise, return false.
Define a void function named CalcTotal that has three parameters: an integer named age, a double named total, and an
integer named discounts. The last two are passed by reference.
The body of CalcTotal will determine if a discount is needed by calling your IsDiscount function. Increase total by the
appropriate amount, either PRICE, or PRICE minus DISCOUNT. Also, increase discounts if necessary.
Define an integer function named GetAge with one integer parameter named movie_goer.
In the body, ask for the movie goer’s age (see sample output) and return the age.
The main function
Declare whatever variables you need and prompt the user for how many movie goers.
Write a loop and call GetAge, and CalcTotal.
Output the total price for the number of movie goers – format your output (see sample output).
Output the number of discounts.
Output “Goodbye”.
Notes:
Be sure you identify which movie goer’s age to enter, e.g. movie goer 1's age, or movie goer 2's age ...
Be sure to include two decimal places wth the price that you output.
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 3 steps with 3 images
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education