Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Credit Card Charge Statistics . 1. Write a program that lets the user enter the total amount of money spent on a credit card for
Credit Card Charge Statistics . 1. Write a program that lets the user enter the total amount of money spent on a credit card for each of 12 months into an array of doubles. The program should have the following functions: A totalAmount function that takes in an array and size of the array as input arguments and returns the total of the 12 values in the array An average Amount function that takes in an array and size of the array as input arguments and returns the average of the 12 values in the array A largestMonth function that takes in an array and size of the array as input arguments and returns the largest value in the array A smallestMonth function that takes in an array and size of the array as input arguments and returns the smallest values in the array The output should look like the following (given the example input): Here are the credit card totals for each month: January : $9.50 February : $19.50 March : $29.50 April : $39.50 May $0.00 June : $59.50 July : $59.50 August : $100.00 September: $40.75 October : $30.75 November : $20.75 December : $10.75 The total amount of money spent was $420.00 The average amount of money spent per month was $35.00 The most amount of money spent in a month was $100.00 The least amount of money spent in a month was $0.00 NOTES: To print out the month names, consider having an array of strings. For the spacing and the proper number of decimal places, you must use functions from the iomanip library. Formatting must be followed, as we are dealing with money. Input Validation: Do not accept negative numbers for monthly credit card charges. If the credit card charge for the month is negative, assume the value to be 0. Pseudocode For pseudocode, the example code below shows a proper amount of pseudocode: // Edwin Ambrosio // CS 2, Section 0120 // Example Code // This program gets the number of employees, then each // of their number of days missed, and calculates the average // number of days missed by all employees. #include #include using namespace std; int getMissed Days (int); // Function to get // missed days for // each employee // Function to calculate the average # of days CS2-Spring 2021 E. Ambrosio // missed for all employees double calcAverage DaysMissed (int, int); int main() int numEmployees = 0; int totalMissed Days; double averageMissedDays; cout > numEmployees) || numEmployees > numDaysMissed) && numDaysMissed
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