Question
Moon Pie Theft: Description and Specifications Jane steals Moonpies from her brother on a regular basis Implement this program in three files: Moonpie.h, Moonpie.cpp, and
Moon Pie Theft:
Description and Specifications
Jane steals Moonpies from her brother on a regular basis
Implement this program in three files: Moonpie.h, Moonpie.cpp, and Functions.cpp.
Write a program named that will:
Ask how many days Jane stole moon pies.
Create a function called makeArray that will accept the number of days and will return a pointer to a dynamically allocated array based on this number.
Create a function called enterStolenMoonPies and call this function from your main function. You will send the array and number of days to this function. You will populate the array by asking the user how many moon pies Jane stole on each day.
Then, create a function called totalMoonPies and call this function from your main function. You will send the array and number of days to this function. In this function, you will figure out how many moon pies in total has been stolen by Jane then return this value back to main.
Then, create a function called averageMoonPies and call this function rom your main function. You will send the array, number of days, and the total # moon pies stolen to this function. In this function, you will figure out the average number of moon pies that were stolen per day then return this value back to main.
Then, create a function called highestMoonPies and call this function from your main function. You will send the array and number of days to this function. In this function, you will figure out the most moon pies Jane stole in a single day and then return this value back to main.
Then, create a function called lowestMoonPies and call this function from your main function. You will send the array and number of days to this function. In the function, you will figure out the least number of moon pies Jane stole in a single day and then return this value back to main.
Last, print out the total, average, highest and lowest in an easy-to-read way in the main function
Make sure to use POINTER NOTATION in every function and in the main function.
Make sure to release the memory of the dynamically allocated array before ending the program.
Sample Output:
How many days did Jane steal moon pies? 5 Enter the number of moon pies stolen on each day. DAY 1 : 3 DAY 2 : 6 DAY 3 : 1 DAY 4 : 7 DAY 5 : 2 ------------------------RESULTS--------------------------- Total # of Moon Pies Stolen : 19 Average # of Moon Pies Stolen : 3.8 Highest # of Moon Pies Stolen : 7 Fewest # of Moon Pies Stolen : 1
Submission Guidelines
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started