Programming Challenge Chapter 3 – Q #13 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,
PROPERTY_TAX = 0.64;
float actual_value;
float total_assessment_value = 0.0, total_property_tax = 0.0;
cout << "What is The Accual
Value Of Property?: ";
cin >> actual_value;
total_assessment_value = actual_value * ASSESSMENT_PER;
total_property_tax = (total_assessment_value / 100.0) *
PROPERTY_TAX;
cout << setprecision(2) << showpoint << fixed;
cout << "Total Assessment
Value is $" << setw(8) << total_assessment_value << endl;
cout << "Total Property Tax
is $" << setw(8) << total_property_tax << 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 two float constants and initialize given values.
- Declare a float variable for input.
- Declare another two float variable for calculation.
- Take input value of property from the user by using cin.
- Calculate the values by using given values and values.
- Use set precision according to question requirement
- In last, display output on the screen in a pattern.
- Return 0 to the main function.
Also, I attach CPP file of this problem. You can download this file
0 Comments