Test" Hello World"

Submitted by: Submitted by

Views: 81

Words: 334

Pages: 2

Category: Other Topics

Date Submitted: 09/07/2014 04:13 PM

Report This Essay

4. Write a program that computes and displays the batting average for a base-ball player when the user inputs the number of hits and at-bats for that player. Batting average is computed by dividing the number of hits by the number of at-bats. You will need the following variables:

"Hits (an Integer) AtBats (an Integer) BatAvg (a Float)

Declare Hits As Integer

Declare AtBats As Integer

Declare BatAvg As Float

Write "How many hits did they make?"

Input Hits

Write "How many times were they at-bat?"

Input AtBats

Set BatAvg = Hits / AtBats

Write "Here is the batting average: " + BatAvg

5.Write a program to compute and dispplay an investment's total interest and final value when the user inputs the original amount invested, rate of interest (as a decimal), and number of years invested. You wil need the following variables:

Interest (a Float) Principal (a Float) FinalValue (A Float) Time (an Integer) Rate (a Float)

You wil need the following formulas:

Interest = Principal * Rate * Time

FinalValue = Principal + Interest

Declare Interest As Float

Declare Principal As Float

Declare Rate As Float

Declare FinalValue As Float

Declare Time As Integer

Write "How much was invested?"

Input Principal

Write "How many years was it invested for?"

Input Time

Write "What is the interest rate in decimal format?"

Input Rate

Set Interest = Principal * Time * Rate

Set FinalValue = Principal + Interest

Write "Your interest is: " + Interest

Write "Your final value is: " + FinalValue

6.Write a program that inputs the first name, middle initial (without the period), and last name of a user and displays that person's name with the first name first, middle initial followed by a period, and last name last. You will need the folowing variables:

FirstName (a String) LastName (a String) MiddleInitial (a String)

Declare FirstName As String

Declare LastName As String

Declare MiddleInitial As String

Write "What is your first name?"

Input...