Chapter 3

Submitted by: Submitted by

Views: 38

Words: 476

Pages: 2

Category: Science and Technology

Date Submitted: 01/25/2015 09:44 PM

Report This Essay

CIST 1305/Chapter 1 Assignment

#2. Write a program that computes and displays a 15 percent tip when the price of a meal is input by the user. (Hint: the tip is computed by multiplying the price of the meal by 0.15.)

Declare MealPrice as a float

Declare Tip as a float

Write “Enter price of meal:”

Input MealPrice (get price to calculate)

Set Tip = MealPrice * 0.15 (calculate)

Write MealPrice (output data)

#3 Write a program that converts a temperature input in degrees Celsius into degrees Fahrenheit and displays both temperatures.

Declare Celsius as a float

Declare Fahrenheit as a float

Declare DegreeCesius as a float

Declare DegreeFahrenheit as a float

Write “Enter temperature in degrees Celsius to convert to Fahrenheit:”

Input DegreesCelsius (get degrees to be converted)

Fahrenheit = (9/5) * Celsius + 32 (calculate)

Write DegreesFahrenheit (output data)

#4 Write a program that computes and displays the batting average for a baseball 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.

Declare Hits as an Integer

Declare AtBats as an Integer

Declare BatAvg as a float

Declare Average as a float

Write “Enter Players number of hit and at-bats:”

Input Hits (get number to be calculated)

Input AtBats (get number to be calculated)

Set Average = (Hits + AtBats) / 2 (calculate)

Write “The average of” (output data)

Write Hits + “and” + AtBats (output data)

Write “is” + Average (output data)

#5 Write a program to compute and display 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.

Declare Interest as a float

Declare Principal as a float

Declare Rate as a float

Declare FinalValue as a float

Declare Time as an integer

Write “Enter Investors Principal, Rate of Interest (as a decimal), and...