Answer:
Explanation:
The objective of this program we are to develop is to compute a C++ program and a flowchart that calculates a cost to replace all tablets and desktop computers in a business.
C++ Program
#include<iostream>
#include<iomanip>
using namespace std;
/*
⦁ // Name:
⦁ // Date:
⦁ // Program Name:
⦁ // Description:
*/
int main()
{
const double SalesTaxRate = .075, DiscountPercent = .10, FinanceCharge = .15;
const double TABLET = 320.00, DESKTOP = 800.00;
double total = 0.0, subTotal = 0.0,avg=0.0;
int numberOfTablets, numberOfDesktop;
cout << "-------------- Welcome to Computer Selling Company ------------------ ";
cout << "Enter number of tablets: ";
cin >> numberOfTablets;
cout << "Enter number of desktops: ";
cin >> numberOfDesktop;
subTotal = TABLET * numberOfTablets + numberOfDesktop * DESKTOP;
char choice;
cout << "Paying cash or financing: (c/f): ";
cin >> choice;
cout << fixed << setprecision(2);
if (choice == 'c' || choice == 'C')
{
cout << "You have choosen paying cash." << endl;
total = subTotal - subTotal * DiscountPercent;
cout << "Discount you get $" << subTotal * DiscountPercent<<endl;
cout << "Sales Tax: $" << SalesTaxRate * total << endl;
total = total + total * SalesTaxRate;
cout << "Total computers' Cost: $" << total << endl;
avg = total / (numberOfDesktop + numberOfTablets);
cout << "Average computer cost: $ " << avg << endl;
}
else if (choice == 'f' || choice == 'F')
{
cout << "You have choosen Finance option." << endl;
total = subTotal + subTotal * FinanceCharge;
cout << "Finance Charge $" << subTotal * FinanceCharge << endl;
cout << "Sales Tax: $" << SalesTaxRate * total << endl;
total = total + total * SalesTaxRate;
cout << "Total computers' Cost: $" << total << endl;
avg = total / (numberOfDesktop + numberOfTablets);
cout << "Average computer cost: $ " << avg << endl;
}
else
{
cout << "Wrong choice.......Existing.... ";
system("pause");
}
//to hold the output screen
system("pause");
}
}
OUTPUT:
The Output of the program is shown in the first data file attached below:
FLOWCHART:
See the second diagram attached for the designed flowchart.