Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In C, this assignment will make use of structs and reading from a file For this assignment you must create an array of structs that

In C, this assignment will make use of structs and reading from a file

For this assignment you must create an array of structs that will record the rental properties that a person owns

lgProperties.txt - https://pastebin.com/kxxSaLWv

smProperties.txt - https://pastebin.com/3hbhRCk1

the 1st line is the number of properties for the owner the 2nd line is the type of property (house, apartment, condo, etc.) the 3rd line is the monthly rental cost the 4th line is the monthly maintenance cost the 5th line is number of bedrooms the 6th line is number of bathrooms

There will be 2 sets of data like this!

Example of input file format:

2 house 1200.00 755.33 3 2 apartment 600.00 200.00 2 1 3 house 700.33 100.22 4 2 house 770.94 350.32 2 2 condo 2000.22 1400.00 1 1

The goal of this section is to have you read in this information from a file and save it into an array of structures which represent the inventory items.

** A max of 50 properties per owner. **

You need to complete the following operations on the data:

1. Calculate total rental income for Owner1 2. Calculate total maintenance costs for Owner2 3. Average price per bedroom for each owners 4. Count # of houses owned by each owner search for the string "house" 5. Average price of all properties

Requirements: - Your program must read input from a file in the proper format, NOT stdin - Your program should accept the filename from the commandline as shown in the example below

Example: ---------------------------------------------------------------------- $ ./a.out infile.txt Total income Owner1: $1800.00 Total cost Owner2: $1850.54 Average price per bedroom Owner1: $360.00 Average price per bedroom Owner2: $495.93 # of Houses Owner1: 1 # of Houses Owner2: 2 Average price of all properties: $1054.30

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Repairing And Querying Databases Under Aggregate Constraints

Authors: Sergio Flesca ,Filippo Furfaro ,Francesco Parisi

2011th Edition

146141640X, 978-1461416401

More Books

Students also viewed these Databases questions