Write a program to create a customer bill for a company. The company sells only five products: TV, DVD player, Remote Controller, CD Player, and Audio Visual Processor. The unit prices are $500.00, $380.00, $35.20, $74.50, and $1500.00, respectively. Part I ( this part is not that much different from Lab 2, as far as formatting) Prompt the user and input for the quantity of each product sold. Calculate the Subtotal for each item and the Subtotal of the bill. Calculate the Tax on the Bill Subtotal. Last calculate the grand Total of Subtotal plus Tax. Test Data sets: 13, 2, 3, 1, 21 Sample Outputs: How many TVs were sold? 13 How many DVD players were sold? 2 How many Remote Controller units were sold? 3 How many CD Players were sold? 1 How many AV Processors were sold? 21

Respuesta :

Answer:

A program written in C++ was create for a customer bill for a company. the company sells five products, which are TV, DVD player, Remote Controller, CD Player, and Audio Visual Processor.

The code is implemented and shown below in the explanation section

Explanation:

Solution:

The C++ Code:

#include<iostream>

#include<string>

#include<iomanip>

using namespace std;

#define taxrate 8.75

int main(){

const double upTv = 500.00;

const double upDvdPlayer = 380.00;

const double upRemoteController = 35.00;

const double upCdPlayer = 74.00;

const double upAudioVideoProcessor = 1500.00;

cout << "How many TVs were sold? ";

double ntv;

cin >> ntv;

cout << "How many DVD players were sold? ";

double ndvd;

cin >> ndvd;

cout << "How many Remote Controllers were sold? ";

double nrc;

cin >> nrc;

cout << "How many CD Players were sold? ";

double ncd;

cin >> ncd;

cout << "How many AV Processors were sold? ";

double nav;

cin >> nav;

double ptv = ntv * upTv;

double pdvd = ndvd * upDvdPlayer;

double prc = nrc * upRemoteController;

double pcd = ncd * upCdPlayer;

double pav = nav * upAudioVideoProcessor;

double tp = ptv + pdvd + prc + pcd + pav;

cout << setw(5) << left << "QTY";

cout << setw(20) << left << "Description";

cout << setw(15) << left << "Unit Price";

cout << setw(15) << left << "Price" << endl;

cout << setw(5) << left << (int)ntv;

cout << setw(20) << left << "TV";

cout << setw(15) << left << fixed << setprecision(2) << upTv;

cout << setw(15) << left << fixed << setprecision(2) << ptv << endl;

cout << setw(5) << left << (int)ndvd;

cout << setw(20) << left << "DVD";

cout << setw(15) << left << fixed << setprecision(2) << upDvdPlayer;

cout << setw(15) << left << fixed << setprecision(2) << pdvd << endl;

cout << setw(5) << left << (int)nrc;

cout << setw(20) << left << "Remote Controller";

cout << setw(15) << left << fixed << setprecision(2) << upRemoteController;

cout << setw(15) << left << fixed << setprecision(2) << prc << endl;

cout << setw(5) << left << (int)ncd;

cout << setw(20) << left << "CD Player";

cout << setw(15) << left << fixed << setprecision(2) << upCdPlayer;

cout << setw(15) << left << fixed << setprecision(2) << pcd << endl;

cout << setw(5) << left << (int)nav;

cout << setw(20) << left << "AV Processor";

cout << setw(15) << left << fixed << setprecision(2) << upAudioVideoProcessor;

cout << setw(15) << left << fixed << setprecision(2) << pav << endl;

cout << setw(15) << left << "SUBTOTAL";

cout << setw(15) << left << fixed << setprecision(2) << tp << endl;

cout << setw(15) << left << "TAX";

cout << setw(15) << left << fixed << setprecision(2) << taxrate << endl;

double ttp = tp + 0.0875 * tp;

cout << setw(15) << left << "Total";

cout << setw(15) << left << fixed << setprecision(2) << ttp << endl;

return 0;

}