Introduction To Programming: Tutorial Task 3.2: Simple Menu
Introduction To Programming: Tutorial Task 3.2: Simple Menu
Introduction To Programming: Tutorial Task 3.2: Simple Menu
Introduction to Programming
Tutorial Task 3.2: Simple Menu
Overview
In this task you combine control flow with modularization to create the basis of a menu system
for a text-based (terminal based) Music player.
Purpose: Learn to combine control flow and modularisation.
Task: Create a program that implements a basic menu system.
Time: This task should be completed before the start of week 6.
Resources: ■ Using a case statement in Ruby
§ Chapters 6 and 8 of ‘Learn to Program’
Chapt 6: Flow Control
Note: Remember to submit all tasks to Doubtfire for assessment. Also make sure you
fix and resubmit any tasks you did not get signed off last week!
Submission Details
You must submit the following files to Doubtfire:
■ SimpleMenu program source code.
Make sure that your task has the following in your submission:
■ Demonstrates use of Ruby programming convention, including indentation within selection
and repetition statements.
■ Demonstrates use of a case statement to perform selection, and a repeat until loop to perform
repetition.
Introduction to Programming Tutorial Task 3.2: Simple Menu
testetesTester
Instructions
Modify a small program that will give the user the following options:
1. Enter or update an album
2. Play an existing album
3. Exit the system
1. Download and extract the resources for this task.
2. Open simple_menu.rb using Atom (or similar).
3. Implement a maintain_albums procedure with the following logic:
■ A repeat-until loop with the following:
■ Display the sub-menu options and prompt the user to select one
■ Read in the user selection and then use a case statement to call a procedure that
corresponds to the selection (or leave the loop if they chose exit)
■ The called procedure should display a message to user about the option. You do not
need to implement the procedure at this stage, just leave it as a ‘stub’ (a placeholder
procedure/function) that displays a message.
Steps:
NB: Use the stub play_existing_album() as an example for the other stubs.
Upload to Doubtfire:
End of Task