In: Computer Science
Write a program to ask the user to en ter the total amount spent at best buy before taxes. Assuming the sales tax applied is 5.7%, display the total amount after taxes and the amount added by the sales tax. Be sure to document your program (add comments) . C++ program
#include <iostream> using namespace std; int main() { double amountSpent; // variable for storing amount spent cout << "Enter amount spent at best buy: "; // prompt user for amount spent cin >> amountSpent; // read amount spent from user double tax = amountSpent * 0.057; // calculate the tax amount double totalSpent = amountSpent + tax; // calculate the total amount spent cout << "Tax amount is $" << tax << endl; // print tax amount cout << "Total amount spent is $" << totalSpent << endl; // print total amount spent return 0; }