Programming Challenge Chapter 3 – Q #14 Senior Citizen Property Tax – Tony Gaddis – Starting Out With C++
Problem: -
Solution: -
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
float const ASSESSMENT_PER = 0.60;
float actual_value, tax_rate;
float quater_tax_bill = 0.0, total_property_tax = 0.0;
cout << "What is The Accual Value Of Property?: ";
cin >> actual_value;
cout << "What is The Current Tax Rate Per $100: ";
cin >> tax_rate;
total_property_tax = (((actual_value * ASSESSMENT_PER) - 5000) / 100.0) * tax_rate;
quater_tax_bill = total_property_tax / 4.0;
cout << setprecision(2) << showpoint << fixed;
cout << "Property Value $" << setw(10) << actual_value << endl;
cout << "Total Property Tax is $" << setw(10) << total_property_tax << endl;
cout << "Quarter Tax Bill is $" << setw(10) << quater_tax_bill << endl;
return 0;
}
This is the solution of this question
OUTPUT OF THIS QUESTION
Input is highlighted with yellow color.
Explanation of this Solution
- Declare a float constant and initialize given values.
- Declare two float variables for input.
- Declare another two float variable for calculation.
- Take input one by one from the user by using cin.
- Calculate the values by using given values.
- Use set precision according to question requirement
- In last, display output on the screen in a pattern.
- Return 0 to the main function.
0 Comments