Code in C++
Write a program to calculate a car dealer’s sale of the same car.
Enter the car price and the number of cars sold.
Calculate the tax (9 % of each car price).
Calculate the shipping charge ($3,000 per car).
The price of the car sale is the sum of the total car price for all cars, the tax for all cars, and the shipping charge for all cars.
You must display the total price of the car sale at the end of the program.
#include <iostream> using namespace std; int main() { int n; double price; cout << "Enter price per car: "; cin >> price; cout << "How many cars were sold: "; cin >> n; double total = price*n; double tax = total*0.09; double shipping = n*3000; cout << "Tax: " << tax << endl; cout << "Shipping: " << shipping << endl; cout << "Total cost: " << total+tax+shipping << endl; return 0; }
Get Answers For Free
Most questions answered within 1 hours.