aa3781@nyu.edu
BAN USER- 0of 0 votes
AnswerA group of friends are tracking the miles per gallon for each of their cars. Each time one of them fills up their gas tank, they record the following in a file:
- aa3781@nyu.edu in United States
His or her name
The type of car they drove
How many miles driven since they last filled up
How many gallons purchased at this fill up
Date of the fill
Their data is formatted as a comma separate value (csv) file with the following format for each row:(#person,carName,milesDriven,gallonsFilled,fillupDate)
Miles are recorded as floating-point numbers and gallons as integers.
Please create a program that allows members of this group to determine the miles per gallon (MPG) of each of their cars during a specific time range. Note: person may have more than one so a time range query might need to output data for one or more cars. A skeleton class will be provided; your job will be to complete the program.
The principal function for querying MPG is of the form (the exact name, data types, etc., can be learned by inspecting the "solution" class in the skeleton code):
GetRangeMPG(PersonName, StartDate, EndDate)
Returns list of objects containing (CarName, MPG)
MPG is calculated as (total miles traveled during time period)/ (total gallons filled during time period.
The dates you receive in the query should be treated inclusively.| Report Duplicate | Flag | PURGE
Software Developer