Guidelines § Codeshould be properly aligned and well commented. § Followc/c++ ru
ID: 3610003 • Letter: G
Question
Guidelines
§ Codeshould be properly aligned and well commented.
§ Followc/c++ rules while writing variables names, function names etc
Problem Statement: Property Tax Calculator
You are required to write a property tax calculator. The basicidea is that you will provide the information regarding property(commercial or residential), it’s market value and yourprogram will calculate the tax.
Detailed Description:
1. The program should display
Please provide customer ID:
Please provide Property Description:
Enter ‘R’for Residential property:
Enter ‘C’for commercial property:
Then the program should take the input,
2. Depending upon the choice that user has entered, your program will further display theprompt
a. If user has entered ‘R’, then your programshould prompt the user to enter the current marketvalue of the property. After taking the input itshould calculate the tax on that property anddisplay it on the screen in following format,
-----------------------------------------------------------------
PropertyType :
PropertyValue:
Taxamount:
-----------------------------------------------------------------
*Tax amountwill be 20% of the property value in case ofresidential property.
b. If user has entered ‘C’, then your programshould prompt the user to enter the current marketvalue of the property. After taking the input itshould calculate the tax on that property anddisplay it on the screen in following format,
-----------------------------------------------------------------
PropertyType :
PropertyValue:
Taxamount:
-----------------------------------------------------------------
*Tax amountwill be 40% of the property value in case ofcommercial property.
c. If the user has entered any thing else then the“R” and “C”, your program should prompt theuser to enter the correct choice.
Explanation / Answer
#include<iostream.h>
#include<conio.h>
#include<stdlib.h>
main(){
intID;
cout<<"Please provide customer ID: ";
cin>>ID;
cout<<endl;
cout<<"Please Provide Property Description: Enter 'R'for Residential Property: Enter 'C' for commercial property:"<<endl;
char type;
cin>>type;
while(! ((type =='R') || (type == 'C')))
{
cout<<"Enteredwrong choice"<<endl;
cout<<"PleaseProvide Property Description: Enter 'R' for ResidentialProperty: Enter 'C' for commercial property: ";
cin>>type;
}
if(type == 'R')
{
cout<<"Enter the current market value of the property: ";
double property;
cin>>property;
cout<<endl<<"---------------------------------------------------------"<<endl;
cout<<"Property Type : ResidentialProperty"<<endl<<"Property Value:"<<property<<endl<<"Tax amount: "<< (0.2 *property)<<endl;
cout<<"---------------------------------------------------------"<<endl;
}
elseif(type == 'C')
{
cout<<"Enter the current market value of the property: ";
double property;
cin>>property;
cout<<endl<<"---------------------------------------------------------"<<endl;
cout<<"Property Type : CommercialProperty"<<endl<<"Property Value:"<<property<<endl<<"Tax amount: "<< (0.4 *property)<<endl;
cout<<"---------------------------------------------------------"<<endl;
}
getch();
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.