Question

Question 1 CSEB113 Write a program to create customers bll for an electrical appliance company. Assume the company sells onl
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Code

#include<iostream>
#include<iomanip>
using namespace std;
float subtotal_TV(int);
float subtotal_VCR(int);
float subtotal_CD(int);
void display_total(float);
const float TV_PRICE=3000.00;
const float VCR_PRICE=500.00;
const float CD_PRICE=300.00;
int main()
{
   int numOfTV,numOfVCR,numOfCD;
   float subTotal;
   cout<<"Enter quantity for TV: ";
   cin>>numOfTV;
   cout<<"Enter quantity for VCR: ";
   cin>>numOfVCR;
   cout<<"Enter quantity for CD Player: ";
   cin>>numOfCD;

   subTotal=subtotal_CD(numOfCD)+subtotal_TV(numOfTV)+subtotal_VCR(numOfVCR);
   cout<<fixed<<setprecision(2);
   cout.width(10);cout <<left <<"\nQTY";
   cout.width(20);cout <<left <<"DESCRIPTION";  
   cout.width(20);cout <<left <<"UNIT PRICE";
   cout.width(20);cout <<left <<"TOTRAL PRICE"<<endl;

   cout.width(10);cout <<left <<numOfTV;
   cout.width(20);cout <<left <<"TV";  
   cout.width(20);cout <<left <<TV_PRICE;
   cout.width(20);cout <<left <<subtotal_TV(numOfTV)<<endl;

   cout.width(10);cout <<left <<numOfVCR;
   cout.width(20);cout <<left <<"VCR";  
   cout.width(20);cout <<left <<VCR_PRICE;
   cout.width(20);cout <<left <<subtotal_VCR(numOfVCR)<<endl;

   cout.width(10);cout <<left <<numOfCD;
   cout.width(20);cout <<left <<"CD PLAYER";  
   cout.width(20);cout <<left <<CD_PRICE;
   cout.width(20);cout <<left <<subtotal_CD(numOfCD)<<endl<<endl;

   cout.width(45);cout <<left <<"SUBTOTAL (RM)";
   cout.width(10);cout <<right <<subTotal<<endl;
   display_total(subTotal);
   return 1;


}
void display_total(float subtotal)
{
   float tax=subtotal*0.06;
   float total=subtotal+tax;
   cout.width(45);cout <<left <<"TAX (RM)";
   cout.width(10);cout <<right <<tax<<endl;
   cout.width(45);cout <<left <<"TOTAL (RM)";
   cout.width(10);cout <<right <<total<<endl<<endl;
}
float subtotal_TV(int quantiy)
{
   return TV_PRICE*quantiy;
}
float subtotal_VCR(int quantiy)
{
   return VCR_PRICE*quantiy;
}
float subtotal_CD(int quantiy)
{
   return CD_PRICE*quantiy;
}

output

CWINDOWS system32\cmd.exe Enter quantity for TV: 1 Enter quantity for VCR: 2 Enter quantity for CD Player: 1 QTY DESCRIPTION

If you have any query regarding the code please ask me in the comment i am here for help you. Please do not direct thumbs down just ask if you have any query. And if you like my work then please appreciates with up vote. Thank You.

Add a comment
Know the answer?
Add Answer to:
Question 1 CSEB113 Write a program to create customer's bll for an electrical appliance company. Assume...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • {Please, I need the solution by ( C cood ) not C++ } Question 1 CSEB113...

    {Please, I need the solution by ( C cood ) not C++ } Question 1 CSEB113 Write a program to create customer's bill for an electrical appliance company. Assume the company sells only three different products: TV, VCR and CD player. The unit prices are RM3000, RM500 and RM300 respectively. The program must read the quantity of each piece of the items purchased from the user. It then calculates the cost of each item, the subtotal and the total cost...

  • Use this code to create multiple functions. #include<iostream> #include<iomanip> #include<fstream> using namespace std; int main() {...

    Use this code to create multiple functions. #include<iostream> #include<iomanip> #include<fstream> using namespace std; int main() { cout << fixed << showpoint << setprecision(2); ofstream outFile; outFile.open("Feras's.txt"); outFile << "..Skinny Feras's Restaurant ..\n\n" << endl; int choise=10, quantity; float paid, SubTotal=0, Tax = .10, Total, RM, more; while(choise!=0) { system("cls"); cout << "\t**Welcome To Skinny Alsaif Restaurant Lol**" << endl; cout << "\nWhat would you like to have?" << endl; cout << "1. Burger." << endl; cout << "2. Pizza." <<...

  • Write a C++ program that asks for the following information about a book order from the...

    Write a C++ program that asks for the following information about a book order from the console: • Title • Author • ISBN (hint: careful about what data type to use - validate 9 or 13 characters) • Price (validate number < 400) • Quantity (number of books to purchase – validate > 0 and < 100) • Fiction/Non-Fiction (‘N’ or ‘F’ - validate) • Genre (‘R’ romance, ‘D’ drama, ‘M’ mystery – validate) Make use of the following data...

  • python question Question 1 Write a Python program to play two games. The program should be...

    python question Question 1 Write a Python program to play two games. The program should be menu driven and should use different functions to play each game. Call the file containing your program fun games.py. Your program should include the following functions: • function guess The Number which implements the number guessing game. This game is played against the computer and outputs the result of the game (win/lose) as well as number of guesses the user made to during the...

  • Write a program that will compute the user annual salary. Prompt the user the enter (1)...

    Write a program that will compute the user annual salary. Prompt the user the enter (1) the weekly salary. Store the information in a double variable. Prompt the user to enter the number of weeks worked in a year. Use an int variable for that. Write code that will compute the user's Annual salary. Gross salary is salary before any deductions are taken. Update the code and prompt the user to enter the federal tax rate and the state's tax...

  • C++ Question Question 3 [43] The Question: You are required to write a program for an...

    C++ Question Question 3 [43] The Question: You are required to write a program for an Online Tutoring Centre to determine the weekly rate depending on the number of sessions the students attend and then to calculate total revenue for the center. The Online Tutoring Centre charges varying weekly rates depending on the on grade of the student and number of sessions per week the student attends as shown in Table 1 below. Grade 8 9 Session 1 75 80...

  • For this lab you will write a Java program that plays the dice game High-Low. In...

    For this lab you will write a Java program that plays the dice game High-Low. In this game a player places a bet on whether the sum of two dice will come up High (totaling 8 or higher), Low (totaling 6 or less) or Sevens (totaling exactly 7). If the player wins, they receive a payout based on the schedule given in the table below: Choice Payout ------ ------ High 1 x Wager Low 1 x Wager Sevens 4 x...

  • For a C program hangman game: Create the function int play_game [play_game ( Game *g )]...

    For a C program hangman game: Create the function int play_game [play_game ( Game *g )] for a C program hangman game. (The existing code for other functions and the program is below, along with what the function needs to do) (Also the link to program files (hangman.h and library file) is below the existing code section. You can use that to check if the code works) What int play_game needs to do mostly involves calling other functions you've already...

  • In c++ Write a program that allows the user to type in any one-line question and then answers tha...

    in c++ Write a program that allows the user to type in any one-line question and then answers that question. Your program won't really respond to the question, rather it will read a random response from a file. Requirements Your program should have a function called getQuestion() which prompts the user for a question and returns the number of characters in the question (including spaces and punctuation, not including the ending newline). If the user enters an empty string they...

  • In this lab, you will create a program to help travelers book flights and hotel stays that will b...

    In this lab, you will create a program to help travelers book flights and hotel stays that will behave like an online booking website. The description of the flights and hotel stays will be stored in two separate String arrays. In addition, two separate arrays of type double will be used to store the prices corresponding to each description. You will create the arrays and populate them with data at the beginning of your program. This is how the arrays...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT