A handy reference for students.
At the beginning of the academic year students are issued with a timetable to show which lessons they have each week. In this program a school week is five days, each with six lessons, but this could easily be changed.
It is helpful for students to create their own copy of their timetable as a handy reference. This program allows the user to create, save, load and output a timetable.
These objectives get progressively harder. Attempt as much of the program as you can in the order presented below. Remember to use a comment to describe a subpprogram, selection or iteration.
timetable of six lessons each of five days, with all elements initialised to be “===”.1 mark
You can visualise the initial timetable like this. Each row is a day 1-5 and each column is a lesson 1-6:
| 1 | 2 | 3 | 4 | 5 | 6 | |
|---|---|---|---|---|---|---|
| 1 | === | === | === | === | === | === |
| 2 | === | === | === | === | === | === |
| 3 | === | === | === | === | === | === |
| 4 | === | === | === | === | === | === |
| 5 | === | === | === | === | === | === |
menu that takes the array timetable as a parameter.
menu to the main program.6 marks
edit_lesson that takes the array timetable array as a parameter.
edit_lesson subprogram in the menu subprogram if the user chose option 2.7 marks
subject_code that takes the name of a subject as a parameter.
edit_lesson so that the subject code is written to the array, not the input the user entered.5 marks
load that takes the array timetable as a parameter.
timetable.txt and store the data in the timetable array.load subprogram in the menu subprogram if the user chose option 3.3 marks
save that takes the array timetable as a parameter.
timetable.txtload subprogram so that the timetable can be loaded and saved.save subprogram in the menu subprogram if the user chose option 4.4 marks
output that takes the array timetable as a parameter.
output subprogram in the menu subprogram if the user chose option 1.3 marks
1. Output timetable
2. Edit a lesson
3. Load
4. Save
5. Close
Enter choice:
1
|-1-||-2-||-3-||-4-||-5-||-6-|
1|===||===||===||===||===||===|
2|===||===||===||===||===||===|
3|===||===||===||===||===||===|
4|===||===||===||===||===||===|
5|===||===||===||===||===||===|
1. Output timetable
2. Edit a lesson
3. Load
4. Save
5. Close
Enter choice:
2
Which day do you want to edit? 1-5:
3
Which lesson do you want to edit? 1-6:
5
Enter the subject:
ENG
Lesson updated.
1. Output timetable
2. Edit a lesson
3. Load
4. Save
5. Close
Enter choice:
1
|-1-||-2-||-3-||-4-||-5-||-6-|
1|===||===||===||===||===||===|
2|===||===||===||===||===||===|
3|===||===||===||===||ENG||===|
4|===||===||===||===||===||===|
5|===||===||===||===||===||===|
1. Output timetable
2. Edit a lesson
3. Load
4. Save
5. Close
Enter choice:
5
2 marks
Maximum mark: 31
If you score less than 25 you need more practice at levels 1-9 before you continue to the next level.