problem in program to calcuate the tax

this is a homework our doctor gave it to us
and no one was able to solve it .

The assessor in your town has estimated the market value of all of the properties in the town and would like
you to write a program that determines the tax owed on each property and the total tax to be collected. The
tax rate is 150 mils per dollar of assessed value (for your information, a mil is 0.1 of a penny. a penny is 0.01 of
a dollar). The assessed value of each property is 28 percent of its estimated market value. (This assessed value
is the value to be used in computing the taxes owed for each property).

Your program should display the assessor’s report which includes a meaningful readable table of output values
and some other additional information as follows: The table should consist of four columns: the name of the
owner of each property, the marked value of each property, the assessed value, and the taxes owed. At the
end of the table, the total taxes and the count of the number of properties processed should be printed. Do
not forget to print column headers in the table. Also, be sure to include some other information at the top of
the assessor’s report such as the assessor’s name, the name of your township, and the date of the report.

Note that you should opt for a modular structure of your program by decomposing the problem into several
functions. Therefore, provide separate functions at least for the following subproblems:
 Display instructions to the user of your program.
 Display the informational heading (name, date, etc.) at the top of the report.
 Process all market values (and print table).
 Display final total.

Write the C++ code of all the functions defined above, and then test your program on the following estimated
market values:
$15000 $248000 $245000 $197000 $137600 $247100 $36500
$353350 $228000 $158000 $152250 $156500 $243700
Your program should continue to read and process market values until a market value of 999999 is read. Then,
it should display the assessor’s report as described above.

here is what i did:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#include <iostream>
#include <time.h>
#include <iomanip>
#include <string>

using namespace std;
void instructions();
void headings(string ,string);
void Table(string,string,int&,double&);
void Total(int , double);
int main()
{
instructions();
cout << "please enter your name: ";
string AsName;
cin>> AsName;
cout << "please enter the name of your township: ";
string TowName;
cin >> TowName;
int counter=0;
double sum=0;
Table(AsName,TowName,counter,sum);
Total(counter,sum);
}


void instructions(){
cout << "this program will determine the tax on each proberty in the town "<< endl;
cout << "you should first enter the Requirement data to output the desired result" << endl;
}
void headings(string AsName,string TowName){
char date[9];
_strdate(date);
cout << setw(8) << "Name Of the assessor: " << AsName << "\t"
"name of the township: " <<  TowName << "\t" <<
"Date :" << date << endl;
}

void Table(string AsName,string TowName,int &i,double &sum)
{
    struct Tables
{
char name[15];
double MarketVal;
double assesedVal;
double tax;
}rec[100];
while (i>=0)
{
cout<<"\nEnter the Name of the owner:";
cin>>rec[i].name;
cout<<"Enter The market value of the proberty:";
cin>>rec[i].MarketVal;
if (rec[i].MarketVal==999999) break;
rec[i].assesedVal=0.28*rec[i].MarketVal;
double taxinpill=rec[i].assesedVal*150;
rec[i].tax = taxinpill/1000;
 sum=sum+rec[i].tax;
i++;
}
cout << endl;
headings(AsName,TowName);
cout<<endl <<setw(15)<<"Name"<<"\t"<<"    Market Value"<<"   Assessed Value"
     <<"\t"<<"Tax"<<endl;
for(int j=0;j<i;j++)
{
cout<<endl<< setw(15)<<rec[j].name<<setw(15)<<rec[j].MarketVal<<setw(12)<<rec[j].assesedVal
     <<setw(18)<<rec[j].tax<<endl;
}
}

void Total(int i,double sum)
{
    cout <<endl<< "The " << i << " proberties " << "has " << sum << " dollars Tax" << endl;
}


i have a problem printing the table , i want first to store the maket value of each proberty and then print the table ,but this is the only way i did it
our doctor told us not to use structure or arrays
so how to do it without struction and arrays.
also how we are gonna store unkown number of variables
(we also should not use vectors and pointer.

Last edited on
Topic archived. No new replies allowed.