Program 1300
Budget: $10 – $30 USD
Foruli Flourish and Balbus Blotts owns a popular bookstore on Diagon Alley called Flourish & Blotts Bookstore. They would like to know how the store profited last year. They want to know the total profits, average profit per month, the most profitable month, the least profitable month, and also the quarterly profits. They would like their results to be printed to the screen, but also to a text file that they get to name themselves.
SPECIFICATIONS:
⦁ You must have a minimum of three arrays:
⦁ profit array – holds the profit amount for each month. Each month is an element in this array.
⦁ monthNames array – holds the name of each month – you may initialize this array at the top of the main function.
⦁ quarterlyProfit array – holds the total profit amount for each quarter
⦁ You must have these functions – make sure you name your function the same:
⦁ main function – calls all the other functions. The “Welcome” message as well as asking the user if they want to run program again should print in the main function. All other cout statements should be in printresults function.
⦁ getprofit function – allows user to enter in the profits for each month into the profit array. Input validation: you must not allow a profit that is less than zero.
⦁ gettotal function – accumulates a running total of the profit array and returns this value back to the main function.
⦁ getmax function – finds the month with the largest profit (in the profit array), returns both the profit amount for this month and the name of the month. Hint: you will need to use a reference variable!
⦁ getmin function - finds the month with the smallest profit (in the profit array), returns both the profit amount for this month and the name of the month. Hint: you will need to use a reference variable!
⦁ getquarterly function – calculates the total profit for each quarter. A quarter is three months (January + February + March is the 1st quarter).
⦁ printresults function – prints the results of the total, average, maximum profit & month, minimum profit & month, and the quarterly profits. Prints both to the screen and to an output file that the user gets to name.
⦁ You may not have any global variables – even if they are constant.
(This is so you must practice sending data to/from functions!)
⦁ The user must be able to run the program as many times as they wish.
⦁ Amounts entered by the user must not be negative so your program should tell the user if they entered a negative amount and force them to enter a positive amount before the program will continue.
⦁ All dollar amounts must be printed in the results with a dollar sign ($) and printed to two numbers after the decimal point. The output also must be in a neat, easy-to-read format. Use stream manipulators
⦁ You must have a comment block at the top of your program (filename, author, date, purpose) as well as a comment above each function telling the function name & purpose.
⦁ You must indent your code properly, document your code well using comments, and use appropriate variable names.
SPECIFICATIONS:
⦁ You must have a minimum of three arrays:
⦁ profit array – holds the profit amount for each month. Each month is an element in this array.
⦁ monthNames array – holds the name of each month – you may initialize this array at the top of the main function.
⦁ quarterlyProfit array – holds the total profit amount for each quarter
⦁ You must have these functions – make sure you name your function the same:
⦁ main function – calls all the other functions. The “Welcome” message as well as asking the user if they want to run program again should print in the main function. All other cout statements should be in printresults function.
⦁ getprofit function – allows user to enter in the profits for each month into the profit array. Input validation: you must not allow a profit that is less than zero.
⦁ gettotal function – accumulates a running total of the profit array and returns this value back to the main function.
⦁ getmax function – finds the month with the largest profit (in the profit array), returns both the profit amount for this month and the name of the month. Hint: you will need to use a reference variable!
⦁ getmin function - finds the month with the smallest profit (in the profit array), returns both the profit amount for this month and the name of the month. Hint: you will need to use a reference variable!
⦁ getquarterly function – calculates the total profit for each quarter. A quarter is three months (January + February + March is the 1st quarter).
⦁ printresults function – prints the results of the total, average, maximum profit & month, minimum profit & month, and the quarterly profits. Prints both to the screen and to an output file that the user gets to name.
⦁ You may not have any global variables – even if they are constant.
(This is so you must practice sending data to/from functions!)
⦁ The user must be able to run the program as many times as they wish.
⦁ Amounts entered by the user must not be negative so your program should tell the user if they entered a negative amount and force them to enter a positive amount before the program will continue.
⦁ All dollar amounts must be printed in the results with a dollar sign ($) and printed to two numbers after the decimal point. The output also must be in a neat, easy-to-read format. Use stream manipulators
⦁ You must have a comment block at the top of your program (filename, author, date, purpose) as well as a comment above each function telling the function name & purpose.
⦁ You must indent your code properly, document your code well using comments, and use appropriate variable names.