CSIS2101_assgn11

.docx

School

Nova Southeastern University *

*We aren’t endorsed by this school

Course

2101

Subject

Computer Science

Date

Jan 9, 2024

Type

docx

Pages

2

Uploaded by the831unit

Report
Assignment 11- File Records. Question 1: ( File Processing ) You are given an input file fn_movies.txt which has movie names streamed by your On demand cable service and the prices of each movie. Rename it with your first name. Each movie record contains the movie name and the respective price followed by a $ sign. Calculate and return the total price of watching all movies in the file using a function fn_calc_stream_charges ( Use your first name ) by reading in each line using a while loop. Call the fn_calc_stream_charges() from the main and Display the total price of watching all the movies in the file using a meaningful sentence on the console in the main. Name this program as fn_proc_movie.py Question 2: ( Append a Movie Record ) Append a record at the end of the input file ( as the last record ) input file fn_movies.txt with your favorite movie which is not in the file and the price ( which is asked as an input ) followed by a $ sign . Once the new item is appended now recalculate the total price of watching all movies by importing the fn_proc_movie.py and using the function fn_calc_stream_charges(). Display the new total price of watching all the movies using a meaningful sentence on the console from the main of this program which should be named as fn_append_movie.py Question 3: ( Modify a Movie Record ) Price of one movie by Demand needs to be increased by 15% Ask the user for the name of the movie and the new price for the movie is updated in input file fn_movies.txt for that item. If the item is not found user need to be informed that the item is not found in the movie file. Once the item is modified now recalculate total price of watching all movies by importing the fn_proc_movie.py and using the function fn_calc_stream_charges. Display the new total price of the movies using a meaningful sentence on the console from the main of this program which should be named as fn_modify_movie.py. For modifying the record use the method we used in class of creating a tmp file and adding the modified record and then deleting the original input file and renaming the file. Question 4: ( Delete a Movie Record ) Now one of the movies need to be deleted from the movie names Ask the user for name of the movie that has to be deleted and delete the movie from the movie names. Once the item is deleted now recalculate total price of watching all movies by importing the fn_proc_movie.py and using the function fn_calc_stream_charges. Display the new total price of the movies using a meaningful sentence on the console from the main of this program which should be named as fn_delete_movie.py. For deleting the record use the same technique as in Modify a movie record. .
Write four individual programs for each question respectively. All programs use the same input file fn_movies.txt and all files modify the same file fn_movies.txt. Finally submit ONE zip file that contains the four programs and ONE fn_movies .txt file ( which has the appended record, modified score and the record deleted. ). Do not hard code the number of records. Program should work for any number of records. Use firstname everywehere in place of fn.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help