Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Something is wrong here. Need this to compile and run in C++. Please help. #include #include #include using namespace std; class SalesTax { private: int

Something is wrong here. Need this to compile and run in C++. Please help.

#include #include #include

using namespace std;

class SalesTax { private: int month; double sales; double countytaxrate = 0.04; double citytaxrate = 0.02; double totalcollected; double countyamt; double cityamt; double totaltaxamt; string monthname;

public: SalesTax() { month = 0; sales = 0.0; monthname = ""; totalcollected = 0.0; countyamt = 0.04; cityamt = 0.02; totaltaxamt = 0.0; }

void inputdata() { cout << "Enter the month number: "; cin >> month; cout << "Enter the sales amount: $"; cin >> sales; }

void convertmonth() { switch (month) { case 1: monthname = "January"; break; case 2: monthname = "February"; break; case 3: monthname = "March"; break; case 4: monthname = "April"; break; case 5: monthname = "May"; break; case 6: monthname = "June"; break; case 7: monthname = "July"; break; case 8: monthname = "August"; break; case 9: monthname = "September"; break; case 10: monthname = "October"; break; case 11: monthname = "November"; break; case 12: monthname = "December"; break; default: monthname = "Invalid Month"; break; } }

void calctax() { totalcollected = sales + sales * (countytaxrate + citytaxrate); countyamt = sales * countytaxrate; cityamt = sales * citytaxrate; totaltaxamt = countyamt + cityamt; }

void printSales() { cout << "Month: " << setw(15) << left << monthname << endl; cout << "Total Collected" << setw(24) << right << fixed << setprecision(2) << "$" << setw(10) << totalcollected << endl; cout << "Sales" << setw(31) << right << "$" << setw(10) << sales << endl; cout << "City Sales Tax" << setw(23) << right << "$" << setw(10) << cityamt << endl; cout << "County Sales Tax" << setw(20) << right << "$" << setw(10) << countyamt << endl; cout << "Total Sales Tax" << setw(24) << right << "$" << setw(10) << totaltaxamt << endl; } };

int main() { SalesTax salestax(); salestax.inputdata(0.02); salestax.convertmonth(); return 0; }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Flash XML Applications Use AS2 And AS3 To Create Photo Galleries Menus And Databases

Authors: Joachim Schnier

1st Edition

0240809173, 978-0240809175

More Books

Students also viewed these Databases questions

Question

1. Why are hallucinations considered a positive symptom?

Answered: 1 week ago