Hello, Please, Can you help me with this? Thank you. Assignment - Loops - Submit
ID: 3908538 • Letter: H
Question
Hello,
Please, Can you help me with this?
Thank you.
Assignment - Loops - Submit Files
The CPlusPlus & LandMinusMinus company needs you to write a program which will produce a report, in both numbers and chart form, showing how their three divisions are doing, for any given month, in generating net sales (unknown number of months).
The corporate tax rate for the company is 30% and the three divisions are East Coast, Mid West, and West Coast (define as constants).
Repeatedly:
Have the user enter a month name, and then process each division, one at a time:
Have the user enter the sales amount and expense amount for the division, using the division name as a prompt. Each sales and expense amount must be zero or greater.
Calculate the net sales amount for the division (sales minus expense, less tax on, sales minus expense).
After the three divisions are processed, display a Net Sales report for the current month which displays, for each division:
-a line showing the division name and its net sales, followed by an asterisk (*) for each $1,000 in net sales (i.e., if a division had $3,700 in net sales, 3 asterisks would be displayed). If a division’s net sales were less than $1,000, display a single hyphen instead of any asterisks (hint: use a loop to display the asterisks).
Then process the next month name, or end the loop (unknown number of months).
After all months are processed, display the average net sales per month, and the name of the month and its net sales amount for the month with the highest net sales.
Use this data for the screen print:
March (division: sales, expense)
East Coast: $15,000, $1,500
Mid West: $20,000, $1,000
West Coast: $18,500, $2,000
August (division: sales, expense)
East Coast: $25,000, $5,500
Mid West: $17,000, $1,000
West Coast: $14,500, $13,100
Assignment - Loops InstructionsThe CPlusPlus & LandMinusMinus company needs you to write a program which will produce a report, in both numbers and chart form, showing how their three divisions are doing, for any given month, in generating net sales (unknown number of months).
The corporate tax rate for the company is 30% and the three divisions are East Coast, Mid West, and West Coast (define as constants).
Repeatedly:
Have the user enter a month name, and then process each division, one at a time:
Have the user enter the sales amount and expense amount for the division, using the division name as a prompt. Each sales and expense amount must be zero or greater.
Calculate the net sales amount for the division (sales minus expense, less tax on, sales minus expense).
After the three divisions are processed, display a Net Sales report for the current month which displays, for each division:
-a line showing the division name and its net sales, followed by an asterisk (*) for each $1,000 in net sales (i.e., if a division had $3,700 in net sales, 3 asterisks would be displayed). If a division’s net sales were less than $1,000, display a single hyphen instead of any asterisks (hint: use a loop to display the asterisks).
Then process the next month name, or end the loop (unknown number of months).
After all months are processed, display the average net sales per month, and the name of the month and its net sales amount for the month with the highest net sales.
Use this data for the screen print:
March (division: sales, expense)
East Coast: $15,000, $1,500
Mid West: $20,000, $1,000
West Coast: $18,500, $2,000
August (division: sales, expense)
East Coast: $25,000, $5,500
Mid West: $17,000, $1,000
West Coast: $14,500, $13,100
Explanation / Answer
#include<iostream>
#include<string>
#include<sstream>
#include<stdlib.h>
using namespace std;
int main(){
double total_net = 0;
int month_count = 0;
double maxnet = 0;
string maxmonth = "";
while (true){
cout << "Enter month name:";
string nm;
cin >> nm;
cout << "East Coast (Sales Expense):";
double es,ee;
cin >> es >> ee;
cout << "Mid West (Sales Expense):";
double ms,me;
cin >> ms >> me;
cout << "West Coast(Sales Expense):";
double ws,we;
cin >> ms >> me;
double nete = (es - ee) - 0.3 * ( es - ee);
double netm = (ms - me) - 0.3 * ( ms - me);
double netw = (ws - we) - 0.3 * ( ws - we);
double netformonth = nete + netm + netw;
cout << nm << "(division: sales, expense)" << endl;
cout <<"East Coast: $" << es << " $" << ee << endl;
cout <<"Mid West: $" << ms << " $" << me << endl;
cout <<"West Coast: $" << ws << " $" << we << endl;
cout << "Net Sales: $" << netformonth;
stringstream ss;
ss << netformonth;
string m;
ss >> m;
int a = m[0] - '0';
if (netformonth <1000)
cout << "-" << endl;
else {
string l = "";
for (int i = 0; i<a; i++)
l = l + "*";
cout << l << endl;
}
if (netformonth > maxnet){
maxnet = netformonth;
maxmonth = nm;
}
total_net = total_net + netformonth;
month_count++;
cout << "Continue (y/n) :";
string ch;
cin >> ch;
if (ch[0] == 'n')
break;
}
cout << "Total average net sales:" << total_net/month_count << endl;
cout << "Month having the maximum sale:" << maxmonth << " $" << maxnet << endl;
return 0;
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.