SIT102 Introduction to Programming
Pass Task 3.1: Silly Name Tester Overview
Control flow allows us to alter the order in which our programs execute. Building on our knowledge of variables, we can now use control flow to create programs that perform more than just a sequence of actions. In this case we will create a program that asks the user for their name, and then gives them a custom message.
Use the instructions on the following pages to create your own Name Tester program. Submit the following files to OnTrack.
Your program code
A screen shot of your program running Answers to the associated questions
Ths focus of this task is using control flow statements including if statements, case statements, while loops, and do while loops.
Follow the instructions in the week 3 videos to build a program that includes the following features:
Has a menu to allow users to select and run multiple different actions.
Allow the user to enter a name and get custom messages based upon the name entered. Use the names of your friends and tutor, and write a custom message for each.
Allow the user to play a guess that number game, guessing a value between 1 and 100.
In this code make sure that you demonstrate the use of:
An if statement with else branch, and nested if else if structures.
A switch/case statement to run actions based on the menu response. A while loop to control repetitions in the guess that number game.
A do while loop to repeat the menu until the user quits.
Make sure to use your read_string, read_double, and read_integer functions for all low level user input.
Once you have this working, download the resources and answer the questions provided. Then grab a screenshot of your program running and upload to OnTrack.
Discuss the following with your tutor to demonstrate your understanding of the concepts covered.
Explain the idea of structured programming, and the idea of blocks of code using sequence, selection, and repetition.
Explain the different control flow mechanisms and how they work. What actions does the computer take to run these?
Explain scenarios where the different control flow statements would be appropriate.