Programming Activities #3
Programming Activities #3
Question #1
Create a program that asks the user to enter the length of the side of a regular octagon and then
calculates and displays the perimeter and area of the octagon. (Hint: How can you alter the program
shown in the Creating a Scratch Program to Find the Area of a Rectangle lesson in the Week #3 module
to do this?)
Formulas:
Perimeter=8 ×length
Correct sentences in the inputs and outputs so that they make sense in the context of the problem.
Separate output statements for the perimeter and area. Your output statements be given in the form of
a sentence (not just a number).
Check: Does your program work? For a regular octagon with side length 5, the perimeter is 40 and the
area is 120.710678. This is an example only of the output your program should produce for the given
input.
Question # 2
Create a program that generates a college email address for a student from their first name, last name
and student ID number. In the program, the user will enter their first name, last name, and student ID
number (as separate inputs). The program will create the student's email address of the form first
number of ID number.first name.last [email protected]. The program will display the student's full
name (in one output), student ID number, and email address (as separate outputs).
Note: For full credit, your program must include the following:
Separate inputs for the first name, last name, and student ID number, including appropriate
prompts displayed to the user.
Separate outputs for the full name (in one output), student ID number, and email address. Your
outputs must include appropriate sentences identifying each of the outputs.
Does your program work? If the user enters John, Smith, 12345 for the first name, last name and
student ID number, your program should output John Smith (in one string) for the name, 12345 for the
ID number and [email protected] for the email, with appropriate sentences for the outputs.
Question #3
You are the loan officer at a bank. You want to create a program that calculates and displays the amount
of simple interest on a short-term GIC. You will need to enter the amount invested, the interest rate as a
percent (i.e. if the interest rate is 5%, you would enter 5 into the program), and the term of the GIC
in months.
Formulas:
Interest=Principal×Rate×Time
Your program must include appropriate prompts to the user for the inputs.
Check: Does your program work? For a $3000 investment at 7% for 8 months, the interest is $140. This
is an example only of the output your program should produce.