Question
C program. Must use int main(int argc , char*argv[]) -Calculate total rental income for first owner -Calculate total maintenance costs for second owner -The average
C program. Must use int main(int argc, char*argv[])
-Calculate total rental income for first owner
-Calculate total maintenance costs for second owner
-The average price per bedroom for each owners
-Count number of houses owned by each owner (search for string house)
-The average price of all properties (both owners)
A max of 60 properties per owner will be read in from the file.
The input file will have the following format:
1st line is number of properties for the owner 2nd line is type of property 3rd line is monthly rental cost 4th line is monthly maintenance cost 5th line is number of bedrooms 6th line is number of bathrooms lines 2-6 will repeat for as many times specified in the first line. *2 input files; each file will have one set of data.
2 separate files listed below
Example of input file format:
2 house 1250.00 756.33 4 1 apartment 640.00 230.00 2 3
3 house 703.38 154.22 3 7 house 740.94 555.33 2 2 condo 2055.76 1700.50 2 6
- the program must read input from two files in the proper format, NOT stdin
- use of two separate structure arrays
- arrays should use the same structure definition
Functions below
int getPropFiles(FILE *fp, aid N[]); float finalIncome(aid N[], int count); float finalCost(aid N[], int count); float priceofbed(aid N[], int count); int numberofhouses(aid N[], int count);
*required struct defintion
struct aid_bet {
}; typedef struct aid_bet aid;
./a.out fp1.txt fp2.txt Total income Owner 1: $1800.00 Total cost Owner 2: $1850.54 Average price of bedroom Owner 1: $360.00 Average price of bedroom Owner 2: $495.93 Number of Houses Owner 1: 1 Number of Houses Owner 2: 2 Average price of all the properties: $1054.30
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started