{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

saleslab-1

# saleslab-1 - This program gets five days of sales data from...

This preview shows pages 1–2. Sign up to view the full content.

// This program gets five days of sales data from the user // and displays the total, average, highest, and lowest amounts. #include <iostream> #include <iomanip> #include <string> using namespace std; // Function prototypes void inputSales(double[],int); double sumArray(double[], int); double getHighest(double[], int); double getLowest(double[], int); double getAverageSales(double[],int); int main() { const int NUM_DAYS = 5; // Number of days double sales[NUM_DAYS], // To hold sales amounts totalSales, // To hold the total sales average, // To hold the average highest, // To hold the highest sales lowest; // To hold the lowest sales // Get the sales data. inputSales(sales, NUM_DAYS); // Get the total sales. totalSales = sumArray(sales, NUM_DAYS); // Calculate the average. average = getAverageSales(sales, NUM_DAYS); // Find the highest sales amount. highest = getHighest(sales, NUM_DAYS); // Find the lowest sales amount. lowest = getLowest(sales, NUM_DAYS); // Display the results. cout << fixed << showpoint << setprecision(2); cout << "The total sales are \$" << totalSales << endl; cout << "The average sales amount is \$" << average << endl;

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern