Question

Answer using C++ Write a program that will calculate the final sales price of a motorcycle;...

Answer using C++

Write a program that will calculate the final sales price of a motorcycle; this includes additional optional packages along with sales
tax. You may assume that the base? price of the motorcycle is $30,000.
First you must ask the user to choose which optional packages they want. The user is only permitted to choose one package. Your program should display a menu of the available packages. The user should enter the package by entering the letter associated with it?.
A - Basic Model (+$0.00)
B - All-Wheel Drive ($1,500)
C - Sport Package (+$2,500)
D - Luxury (+3,000)
E - Automatic (+10,000)
If the user enters an invalid letter, you must continue asking them? to enter a letter until they enter a valid choice.
Once they’ve entered a valid letter, then ask them for the sales tax rate in their state. You should clearly indicate if they
should enter, for example, 7 or 0.07 for a 7% sales tax.
Finally, your program should compute the final sales price as the base price, plus the price of the chosen package, all
multiplied by 1 + sales tax rate. For example, if the user chooses option D and there is a sales tax of 5%, then the final
price would be $35,000 * 1.05 = $36,750.
Your printout need not include , placeholders, but should be limited to two decimal places to indicate proper dollars/cents
notation.

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


#include <iostream>

using namespace std;

int main()
{
char ch;
int base=30000;
double tax, total;
while(true){
cout<<"Choose Package from below options\n";
cout<<"A - Basic Model (+$0.00)"<<endl;
cout<<"B - All-Wheel Drive ($1,500)"<<endl;
cout<<"C - Sport Package (+$2,500)"<<endl;
cout<<"D - Luxury (+3,000)"<<endl;
cout<<"E - Automatic (+10,000)"<<endl;
cin>>ch;
// break the loop if it is valid input
if(ch>='A' && ch<='E')
break;
else
cout<<"Invalid input\n";
}
cout<<"Enter tax % in you state (0-100): \n";
cin>>tax;
// finds Package Price based on input
if(ch=='B')
total = base+1500;
  
if(ch=='C')
total = base+2500;
  
if(ch=='D')
total = base+3000;
if(ch=='E')
total = base+10000;
// finding tax
total += total * (tax/100.0);
printf("Total Price with taxes $%.2lf",total);
  
}

input Choose Package from below options - Basic Model (+$0.00) B All-Wheel Drive (S1,500) C Sport Package (+2,500) D Luxury (

Add a comment
Know the answer?
Add Answer to:
Answer using C++ Write a program that will calculate the final sales price of a motorcycle;...
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
  • java; programing language Write a program to calculate the price of a purchase. It should ask...

    java; programing language Write a program to calculate the price of a purchase. It should ask the user to enter the name of the item bought (like sweater, apple, …), number of items bought (4, 5 lbs,…), price per item ($40.50, $1.99 per pound,…), and the sales tax rate (8.35% for example). It should calculate the subtotal (price*number of items), sales tax (subtotal*sales tax), and total price (subtotal+ sales tax). It should print all the information in a receipt form

  • Write a C++ program that will calculate the total amount of money for book sales at...

    Write a C++ program that will calculate the total amount of money for book sales at an online store. For each sale, your program should ask the number of books sold and then the price for each book and the shipping method (‘S’ for standard shipping and ‘E’ for expedited shipping). The program will produce a bill showing the subtotal, the sales tax, the discount, the shipping charge, and the final total for the sale. The program will continue processing...

  • Write a C++ program that calculates the discount of the original price of an item and...

    Write a C++ program that calculates the discount of the original price of an item and displays the new price, and the total amount of savings. This program should have a separate header (discount.h), implementation (discount.cpp) and application files (main.cpp). The program must also have user input: the user must be prompted to enter data (the original price, and the percent off as a percentage). There must also be a validation, for example: Output: “Enter the original price of the...

  • In C using (printf and scanf) Write a program to ask the user for the weight...

    In C using (printf and scanf) Write a program to ask the user for the weight of a package, and display the shipping charges for the package. If the weight of the package is less than or equal to 0 pounds, inform the user and exit the program. The shipping charges are: Weight of Package Shipping Charge 2 pounds or less $1.25 Over 2 pounds but not more than 6 pounds $2.50 Over 6 pounds but not more than 10...

  • USING PYTHON PROGRAMING LANGUAGE Write a program that first asks the user to enter a “special”...

    USING PYTHON PROGRAMING LANGUAGE Write a program that first asks the user to enter a “special” letter. The program should then ask the user to enter a single line sentence containing all lowercase letters and no punctuation, except for a period at the end. The program will then output the number of times that this letter appears in the sentence. Example: Enter a special letter: t Enter a sentence: here is my little sentence. Your letter appears 3 times. (t...

  • 1. Write a program that calculates sales price of each article. The program will get the...

    1. Write a program that calculates sales price of each article. The program will get the unit price of each article through the keyboard, and then calculate actual sales price. Actual sales price of each article is calculated as follows: • Sales Price = (2 x unit price) + (unit price x sales tax) Sales tax for each item is fixed to 5%. Your program should keep asking user to input unit price. If the user does not have any...

  • Q2.     Write a program that will compute the total sales tax on a $45 purchase. Assume...

    Q2.     Write a program that will compute the total sales tax on a $45 purchase. Assume that the state sales tax is 4% and county sales tax is 2%. Declare a variable called price , of datatype double Ask the user to enter a price and the user inputs in the purchase price. Use setprecision(2) like Q1. in C++

  • In this program, you will be using C++ programming constructs, such as functions. main.cpp Write a...

    In this program, you will be using C++ programming constructs, such as functions. main.cpp Write a program that asks the user to enter an integer value. Your program will then display that integer back to the user. Your program should include a function called getInteger that requests an integer value from the user and returns that value back to the caller. Your main () function will call the function getInteger and will then display the value returned by that function....

  • Q1. Write program calculate the final price of a purchased item using values entered by the...

    Q1. Write program calculate the final price of a purchased item using values entered by the user Hint: you are required to use formatting output for number, currency and percentage. --------------------[Print Receipt] ------------ Enter the quantity: 6 Enter the unit price: $1.98 Subtotals: $10.14 Tax: $ 0.61 at 6% Total: $10.75 ------------------------------------------------ Q2. Write a program that prompts for and reads the users’ first name and last name, Job title, DOB (date of Birth), and the Email address (separately). Then...

  • Write a C++ program to compute the total volume of N cones, where N is a...

    Write a C++ program to compute the total volume of N cones, where N is a number entered by the user. Repeat the request for N until the user enters a positive number. For each cone, ask for the radius and height, compute the volume, and add that volume to the total. Each time you ask the user to enter either the height or the radius, if the user does not enter a positive number, display an error message and...

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