Question: Can you please make a flowchart for this program? //This program will ask the user to enter today's sales //(rounded to the nearest $100)for each
Can you please make a flowchart for this program?
//This program will ask the user to enter today's sales //(rounded to the nearest $100)for each of three stores. //The program should then produce a bar graph displaying each //store's sales. Create each bar in the graph by displaying //a row of asterisks. Each asterisk should represent $100 of sales.
#include
using namespace std;
int main() { //Necessary variables double store1, store2, store3; int asterisk1, asterisk2, asterisk3;
//Ask user to enter today's sales //(rounded to the nearest $100)for each of three stores. cout << "To create the bar graph of today's sales, please enter the sales (rounded to the nearest $100) ";
//Enter store 1 sales cout << "Enter the sales for store 1: $"; cin >> store1;
while (store1 < 0) { cout << "Enter the sales for store 1: $"; cin >> store1; }
//Enter store 2 sales cout << "Enter the sales for store 2: $"; cin >> store2;
while (store2 < 0) { cout << "Enter the sales for store 2: $"; cin >> store2; } //Enter store 3 sales cout << "Enter the sales for store 3: $"; cin >> store3;
while (store3 < 0) { cout << "Enter the sales for store 3: $"; cin >> store3; }
asterisk1 = round(store1/100.0); asterisk2 = round(store2/100.0); asterisk3 = round(store3/100.0); cout << " Daily Sales (each *=$100)" << endl; cout << "--------------------------" << endl; cout << "Store 1: "; for (int i = 0; i < asterisk1; ++i) cout << "*"; cout << " Store 2: "; for (int i = 0; i < asterisk2; ++i) cout << "*"; cout << " Store 3: "; for (int i = 0; i < asterisk3; ++i) cout << "*"; cout << endl; system("pause");
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
