Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The data files will be organized as they were in the previous homework. However, for this homework, the record / row data may be spread

The data files will be organized as they were in the previous homework. However, for this homework, the record/row data may be spread across multiple files. When EV reads in each file, it must make sure the data in that file is internally consistent and alert the user to any errors encountered (as described in Homework 1). If a record appears in more than one data file, EV will retain the data
read most recently (note the difference from the previous homework, although it will still reject duplicates within the same file). As each file is read in, EV must update internal tallies of the total number of EVRecord it attempted to read, the total number of valid record/rows read in, and the total number of EVRecord currently stored in memory. (Note that these totals may be the same, but they may differ, as some records may be duplicated.
After reading in and storing all the records from all the specified files, then you need to create RecordIDs, Emission reduction and Petroleum reduction. After creating those columns for each valid record as specified in Homework 3, EV will enter a data manipulation loop (as mentioned above). In this loop, EV 1.0 will prompt the user with four options: o for output, s for sort, f for find, e for efficiency, and q for quit (Enter (o)utput,(s)ort,(f)ind,(e)fficiency, or (q)uit: ).
If the user selects output, EV 1.0 will prompt the user for a filename (Enter output file name: ) and read it in from the console. If the user hits enter without specifying a filename, EV 1.0 will send the output to standard out in the console. Otherwise, it will attempt to open the specified file for writing. If the user enters the name of a file that is not accessible, EV 1.0 will report the error (File is not available.) and repeat the prompt for the file name. If the file is accessible or the user has specified the standard out, EV 1.0 will print out the records in whichever order it is presently ordered, followed by a row showing the internal tallies, for example:
Data lines read: 5505; Records in memory: 4217; Invalid records: 750, Duplicate records: 538
Other than this trailing row, EV 1.0 will exactly match the output format used by EV 0.1 through EV 0.4.
If the user selects sort, EV 1.0 will prompt the user for the data field to sort the record (Enter sort attribute: ). The user may enter a numeric value, which corresponds to the column order on which to sort. If the user enters an invalid value for the column field on which to sort, EV 1.0 will return to the data manipulation loop. If the user selects to sort by any valid column, EV 1.0 will sort the data based on those corresponding values.
If the user selects find from the data manipulation loop, EV 1.0 will prompt the user for the data field on which to search (Enter search column: ). As with sort, the user may select a numeric value corresponding to the column order on which to search. If the user selects any other invalid column, EV 1.0 will return to the data manipulation loop.
If the user chooses to find any other valid column, EV 1.0 will prompt the user for the value for search (Enter exact text on which to search for column value: ). If the user enters any text, EV 1.0 will search for the given value but does not need to perform any validity check on the input data. If the user just hits enter without giving a search string, EV 1.0 will return to the data manipulation loop.
If EV 1.0 finds one or more fields exactly matching a user request, EV 1.0 should display for the user (by sending to standard out in the console) all the corresponding record in the same format as when printing the data, but with a trailing row that indicates the number of records found in the format shown in the following example:
Records found: 37.
If no matching records are found, EV 1.0 should simply send to standard out the line indicating that the number of records found is zero:
Records found: 0.
If the user selects efficiency from the data manipulation loop, EV 1.0 will prompt the user to enter the year of the vehicle. After the user enters the year and if it is valid, EV 1.0 will list the most efficient and the least efficient vehicle with make and model for that year. It is important to note that there could be more than one type of vehicle for the most and least efficient vehicle. You just need to list one type for each vehicle and model. To find the efficiency, you need to read a different file that names as EV_efficiency.csv. Submitted date will be used as year.

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

Step: 3

blur-text-image

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

Database Design And Relational Theory Normal Forms And All That Jazz

Authors: Chris Date

1st Edition

1449328016, 978-1449328016

More Books

Students also viewed these Databases questions