You are on page 1of 17

Activity 1(Problem #1)

Create a program that will ask the user to input three number and be able to display the sum and average of

the three numbers

Sample Output
Enter first number: 3 Enter second number: 4 Enter third number: 7 Sum : 14 Average: 4.66

Activity 1(Problem #2)


Create a program that will ask the user to input length and width of the rectangle. Display the area and perimeter of the

rectangle

Sample Output
Enter the length: 7 Enter the width: 5 Area: 35 Perimeter: 24

Activity 1(Problem #3)


Create a program

that will ask the user to input a radius of the circle and be able to display the area and circumference of the circle

Sample Output
Enter the radius: 5

Circumference: 31.4 Area: 78.5

Loopin

g Activity
Problem #1
Write an

application that calculates the amount of money earned on an investment, based on an 8% annual return. Prompt the user to enter an investment amount and the number of years for the investment.

Modify the Investmen t application

in so the user also enters the interest rate. In

addition to the error message that displays

when the investmen t or term is 0, display an error

message if the interest rate is 0.


Sample Output

Give a value for principal 1000 Give a value for year 5 Give a value for rate 10 Payable Amount: 1610.51

Problem #2
Write an application

that displays the results of a series of 10 coin tosses. After each coin toss, display whether the toss represents heads or tails. After the 10 tosses are complete, display the percentages of heads and tails.

Modify the application in Exercise 9a so that you generate 1000 coin tosses and keep track of the heads and tails. Do not display the coin toss result with each flip, but instead display percentages of the heads and tails

after the 1000 coin tosses are complete.


Sample Output

Head: 513 Tail: 487 Head Percent: 51.30 Tail Percent: 48.70