Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

what I am missing? I am trying to make the sales tax 0 % for the cars that are <

ID: 3568391 • Letter: W

Question

what I am missing? I am trying to make the sales tax 0 % for the cars that are < $50000. but if the price of the car is $50000 and more the luxury tax will be added by 0.1 or 10% of the sales price. the state and the city tax will be added to both of them. any help will be greatly appriciated.

#include
using namespace std;
int main()
{
float salesTax, stateSalesTax, citySalesTax, luxuryTax, amountDue, salePrice;
cout << "the price of the car: ";
cin >> salePrice;
cout << " the sales tax is : " << salePrice*0.04 << endl;
cout << " the city sales tax is : "<< salePrice*0.015 << endl;
if(salePrice >= 50000)
{
   luxuryTax = salePrice*0.1;
   cout << "the car is luxury and add the luxury tax ";
}
else
{
   luxuryTax = salePrice*0;
   cout << "the car is not luxury" << luxuryTax<< endl;
}
salesTax =stateSalesTax +citySalesTax+luxuryTax;

salesTax = salePrice*0.04 +salePrice*0.015+salePrice*0.1;
cout << " the sales tax is : " << salesTax<< endl;
amountDue = (salesTax + salePrice);
cout << " the whole amount is:" <


return 0;  
}

Explanation / Answer

#include<iostream>
using namespace std;
int main()
{
   float salesTax, stateSalesTax, citySalesTax, luxuryTax, amountDue, salePrice;
   cout << "the price of the car: ";
   cin >> salePrice;
   cout << " the sales tax is : " << salePrice*0.04 << endl;
   cout << " the city sales tax is : "<< salePrice*0.015 << endl;
   if(salePrice >= 50000)
   {
       luxuryTax = salePrice*0.1;
       cout << "the car is luxury and add the luxury tax ";
   }
   else
   {
       luxuryTax = salePrice*0;
       cout << "the car is not luxury" << luxuryTax<< endl;
   }
  
   stateSalesTax=salePrice*0.04;
   citySalesTax=salePrice*0.015;
   salesTax =stateSalesTax +citySalesTax+luxuryTax;
   cout << " the sales tax is : " << salesTax<< endl;
   amountDue = (salesTax + salePrice);
   cout << " the whole amount is:" <<amountDue << endl;


   return 0;
}