Homework Assignment1

# Homework Assignment1 - Data requirements Problem input –...

This preview shows page 1. Sign up to view the full content.

Homework Assignment1: CS101-1 1. Write a program that calculates mileage reimbursement for a salesperson at a rate of \$0.35 per mile. Your program should interact with the user in this manner: MILAGE REIMBERSMENT CALCULATOR Enter beginning odometer reading=> 132505.2 Enter ending odometer reading=> 13810.6 You traveled 305.4 miles. At \$0.35 per mile, Your reimbursement is \$106.89. 2. Write a program that estimates the temperature in a freezer (in degrees C) given the elapsed time (hours) since a power failure. Assume this temperature (T) is given by T = 4t^2/ (t+2) – 20 Where t is the time since the power failure Your program should prompt the user to enter how long it has been since the start of power failure in whole hours and minutes. Note that you will need to convert the elapsed time into hours. For example, if the user entered 2:30 (2 hours 30 minutes), you would convert this to 2.5 hours. 3. Write a program to convert a temperature in degrees Fahrenheit to degrees Celsius.
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Data requirements: Problem input – int Fahrenheit Problem output – Double Celsius Relevant formula – Celsius = 5/9 (Fahrenheit – 32) 4. Write a program to take two numbers as input data and to display their sum, difference, product, and their average. Problem Inputs: Double x,y Problem outputs: Double sum, difference, product, and average 5. Write a program that predicts the score needed on a final exam to achieve a desired grade in a course. The program should interact with the user in following manner: Enter Desired grade > B Enter minimum average required > 79.5 Enter current average in course> 74.6 Enter how much the final counts as percentage of the course grade> 25 You need a score of 94.20 on the final to get a B. 6. Write a program that takes the length and width of a rectangle. It computes its area, and displays it....
View Full Document

## This note was uploaded on 11/02/2009 for the course CS nasser taught by Professor Gk during the Winter '09 term at Fox Valley Technical College.

Ask a homework question - tutors are online