Question: Task 1 : Binary Files [ 5 0 PTS ] 1 a ) Write a program that prompts the user to enter sales data for

Task 1: Binary Files [50 PTS]
1a) Write a program that prompts the user to enter sales data for each day of the week (7 entries in total) and then writes this data to a binary file.
Your program should perform the following steps:
1.Prompt the user to enter sales data for each day of the week. For simplicity, you can assume that the sales data entered will be integers representing the amount of sales for each day.
2. Store the entered sales data in an array or a similar data structure.
3. Write the sales data to a binary file.
1b) Write another program that reads the sales information from the binary file created in Part 1 and calculates the average sales for the week.
Your program should perform the following steps:
1.Read the sales data from the binary file.
2.Calculate the total sales for the week by summing up all the sales data.
3.Calculate the average sales by dividing the total sales by the number of days (7 in this case).
4.Display the average sales to the user.
Task 2: Random Access Files [50 PTS]
2a) Write a program that allows the user to input letter grades for 5 classes and writes these grades to a random access file.
Your program should follow these steps:
1.Prompt the user to enter letter grades for 5 classes. You can assume that each grade will be a single character representing the letter grade (e.g.,'A','B','C', etc.).
2.Store the entered letter grades in a suitable data structure.
3. Write the letter grades to a random access file, where each grade is stored at a specific position corresponding to its class (e.g., the grade for the first class at position 0, the grade for the second class at position 1, and so on).
2b) Write another program that reads the letter grades from the random access file created in Part 1 and retrieves the letter grade for the third class.
Your program should perform the following steps:
1. Open the random access file for reading.
2. Seek to the position in the file corresponding to the third class.
3. Read and retrieve the letter grade stored at that position.
4. Display the retrieved letter grade to the user.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!