you will need to write a single python program that given an input file produces a report that reports information about the file. Your program should have the following methods/functions:: (20%)...


you will need to write a single python program that given an input file produces a report that reports information about the file.


Your program should have the following methods/functions::




  1. (20%) main()function that runs the overall program.




    1. First, you have to ask the user for input usinggetInput()function (see below)




    2. Then, repeatedly ask user for next command usinggetCommand()function (see below)




    3. Depending on the command received, either call the function that represents the command


      (or stop looping if quit was received)




    4. Note: somewhere in the program, there must be a call tomain()






  2. (20%) getInput()function that asks the user for an input file.




    1. The function should repeatedly ask for a file until given a filename




    2. The function should return a valid file name (test by seeing if the file opens)






  3. (10%) getCommand()function that returns a command which should be one of the following: a. list


    b. search c. add
    d. quit




  4. (10%) list() functionshould output a list of all records stored in the file




  5. (30%) search()function should allow the user to search for a specific item or a list of items and


    display the records stored in the file that match the query




    1. The function should take three parameters: name of field to search, value to search for, type


      of search




    2. Type of search can be either:equal, notequal, greaterthan, lessthan




    3. The function should take the three things and produce a list of items that match the given


      criteria.






  6. (10%) add()function should allow the user to add a record to the file




a. The function should ask for each element of the record from the user


Record:
Integer EID


String name String position Integer yos Double salary


Record Format (each record is on a line by itself): EID:name:position:yos:salary

Oct 23, 2021
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here