Goals

The goals of this assignment are to learn the following:

Computer Science Principles Curriculum

Common Core Standards

Overview

In this assignment you will be creating a program that mimics a radio. The user will be able to select from 1 of 4 stations and each station will play a different tune. The user will also be able to set how long the tune plays for.

The duration and station input from the user must be checked for correctness. These values will be verified in the Main class, and then passed to the Station class. The Station class will be responsible for playing the music after receiving the station and duration input. The Main class will be responsible for asking the user for these values. You will learn about how to use separate files, and how to utilize the classes you define in them. Create a new assignment and label it Assignment 5_1.

Class Main

Class Main should have the following actions:

Class Station

Class Station should have the following actions:

Using Separate Files

Other Information

Sample Output

Entering an invalid time

"Please select your station (1-4):"
"3"
"How long do you want to play? (1-20):"
"0"
"Incorrect input. Please try again."
"How long do you want to play? (1-20):""
"6"

Entering an invalid station

"Please select your station (1-4):"
"5"
"Incorrect input. Please try again."
"Please select your station (1-4):"
"4"
"How long do you want to play? (1-20):"
"10"

Entering valid information

"Please select your station (1-4):"
"2"
"How long do you want to play? (1-20):"
"19"

Next Tutorial

In the next tutorial, we will discuss Assignment 5.2, which describes an introduction to recursion..