Question

Mountain Coffee wants a program that allows a clerk to enter the number of pounds of...

Mountain Coffee wants a program that allows a clerk to enter the number of pounds of coffee ordered, the price per pound, and whether the customer should be charged a 3.5% sales tax. The program should calculate and display the total amount the customer owes. Use an int variable for the number of pounds, a double variable for the price per pound, and a char variable for the sales tax information.

a. Create an IPO chart for the problem, and then desk-check the algorithm twice. For the first desk-check, use 5 as the number of pounds and 13.69 as the price per pound; the customer should be charged the sales tax. For the second desk-check, use 3 as the number of pounds and 11.59 as the price per pound; the customer should not be charged the sales tax.

b. List the input, processing, and output items, as well as the algorithm, in a chart similar to the one shown earlier in Figure 5-27. Then code the algorithm into a program.

c. Desk-check the program using the same data used to desk-check the algorithm.

d. If necessary, create a new project named Introductory11 Project, and save it in the Cpp8\Chap05 folder. Enter your C++ instructions into a source file named Introductory11.cpp. Also enter appropriate comments and any additional instructions required by the compiler. Display the total amount owed in fixed-point notation with two decimal places. Test the program using the same data used to desk-check the program.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Copyable code:
File Name: Introductory11.cpp
//Include the needed files
#include <iostream>
#include <string>
#include <iomanip>
#include <cstdlib>
//Use the namespace std
using namespace std;
//main
int main()
{
//Declare nPounds
int nPounds=0;
//Declare priceAmount
double priceAmount=0;
//Declare taxInfo
char taxInfo = 'n';
//Declare tempAmount
double tempAmount =0;
//Declare taxAmount
double taxAmount =0;
//Declare totAmount
double totAmount =0;
//Prompt
cout<<"Enter the number of pounds:";
//Read nPounds
cin>>nPounds;
//Prompt
cout<<"Enter the price:";
//Read priceAmount
cin>>priceAmount;
//Prompt
cout<<"Is tax chargeable (y/n)?";
//Read taxInfo
cin>>taxInfo;
//Check condition
if(taxInfo =='y')
{
//Find tempAmount
tempAmount = nPounds * priceAmount;
//Find taxAmount
taxAmount = tempAmount * 0.035;
//Find totAmount
totAmount = tempAmount + taxAmount;
}
//Else
else
{
//Find totAmount
totAmount = nPounds * priceAmount;
}
//Display totAmount
cout<<"Total Amount:"<<fixed<<setprecision(2)<<totAmount<<endl;
//Pause window
system("pause");
//Stop
return 0;
}

Add a comment
Know the answer?
Add Answer to:
Mountain Coffee wants a program that allows a clerk to enter the number of pounds of...
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
  • 25. In this exercise, you create a program for the sales manager at Computer Haven, a...

    25. In this exercise, you create a program for the sales manager at Computer Haven, a small business that offers motivational seminars to local companies. Figure 7-53 shows the charge for attending a seminar. Notice that the charge per person depends on the number of people the company registers. For example, the cost for four registrants is $400; the cost for two registrants is $300. The program should allow the sales manager to enter the number of registrants for as...

  • C++ The manager of Keystone Tile wants an application that displays the area of a rectangular...

    C++ The manager of Keystone Tile wants an application that displays the area of a rectangular floor, given its measurements in feet. It should also display the total cost of tiling the floor, given the price per square foot of tile. 1-Create a new project named Intermediate13 Project, and save it in the Cpp8\Chap04 folder. Enter your C++ instructions into a source file named Intermediate13.cpp. Also enter appropriate comments and any additional instructions required by the compiler. Test the program...

  • chapter 7. Create a program that allows the user to enter the ages (in years) of...

    chapter 7. Create a program that allows the user to enter the ages (in years) of five people. The program should display the average age. Use the for the statement. Display the average age with one decimal place. If necessary, create a new project named TryThis15 Project, and save it in the Cpp8\Chap07 folder. Enter the C++ instructions into a source file named TryThis15.cpp. Also, enter appropriate comments and any additional instructions required by the compiler. Test the program using...

  • A store is having a sale. The manager wants a program that allows the sales clerk...

    A store is having a sale. The manager wants a program that allows the sales clerk to enter the original price of an item and the discount rate. The program should calculate and display the sale price. find the inputs and outputs, write the pseudocode, and desk check the pseudocode.

  • Scenario: John Lee wants a program that allows him to enter the following three pieces of information. His savings accou...

    Scenario: John Lee wants a program that allows him to enter the following three pieces of information. His savings account balance at the beginning of the month, the amount of money he deposited during the month, and the amount of money he withdrew during the month. He wants the program to display his balance at the end of the month. Requirements: Complete an IPO chart for this problem, using pseudo code or flowchart in the Processing column. Also complete a...

  • A store sells cups and plates for parties. The owners want a program that allows them...

    A store sells cups and plates for parties. The owners want a program that allows them to enter the price of a cup, the price of a plate, the number of cups purchased, the number of plates purchased, and the sales tax rate. The program should calculate and display the total cost of the purchase. desk check the pseudocode

  • Part I: Problem: Code the following in Java: Candy Class -price -number of pounds sold Create...

    Part I: Problem: Code the following in Java: Candy Class -price -number of pounds sold Create the following methods: -Two constructors – default and second - accessor and mutator methods for each of the fields. - check for invalid price. Negative price is invalid (use if then else and display error message) - a method named userInput to get user input for all the fields. - check for invalid price. Negative price is invalid (use a loop to prompt the...

  • Create a payroll program named CalcPay that allows the user to enter two double valuesand a...

    Create a payroll program named CalcPay that allows the user to enter two double valuesand a string namely hours worked, hourly rate and name. After the user enters the rate, hours,and name the program should calculate the gross pay. Compute federal withholding tax which is subtracted from gross based on the following table: Hints: (100pts) Use methods as deemed appropriate. 0 to 99.99 6% 100.00 to 299.99 12% 300.00 to 599.99 18% 600.00 and up 21%. Display the output. The...

  • Create a payroll program named CalcPay that allows the user to enter two double valuesand a...

    Create a payroll program named CalcPay that allows the user to enter two double valuesand a string namely hours worked, hourly rate and name. After the user enters the rate, hours,and name the program should calculate the gross pay. Compute federal withholding tax which is subtracted from gross based on the following table: Hints: (100pts) Use methods as deemed appropriate. 0 to 99.99 6% 100.00 to 299.99 12% 300.00 to 599.99 18% 600.00 and up 21%. Display the output. The...

  • Your instructor would like you to write a program in Java which would ask for the clerk to enter ...

    Your instructor would like you to write a program in Java which would ask for the clerk to enter the total amount of the customer’s order. The program will then calculate a seven percent (7%) sales tax. Commission is computed based on the following: order amount id="mce_marker" - $200 commission is 2%, order amount $201 - $400 commission is 3%, order amount $401 - $600 commission is 4%, order amount > $600 commission is 5%, The program will display the...

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