ISE 135 HW 2 Solution Key (1)
docx
keyboard_arrow_up
School
University Of Georgia *
*We aren’t endorsed by this school
Course
135
Subject
Industrial Engineering
Date
Jan 9, 2024
Type
docx
Pages
4
Uploaded by ChancellorEnergyCaterpillar26
ISE 135 COMPUTER BASED MODELING
HOMEWORK 2 SOLUTION KEY
Question 1: The following steps give the name and birth year of a famous inventor. Write a program that has one line of code for each step. Lines that display data should use the given variable names.
a)
Create the variable firstName and assign it the value “Thomas”.
b)
Create the variable middleName and assign it the value “Alva”.
c)
Create the variable lastName and assign it the value “Edison”.
d)
Create the variable yearOfBirth and assign it the value 1847.
e)
Display the inventor’s full name followed by a comma and his year of birth.
Question 2: Americans eat an average of 350 slices of pizza per second. How many slices of pizza do they eat per day? Write a program to solve the problem and display the answer.
RUN
Question 3: Write a program to carry out the stated task (An outcome example is given)
Server’s Tip:
Calculate the amount of a server’s tip, given the amount of the bill and the percentage tip as input. (This problem is similar to the one we solved in PS-1/18. This time we ask data from the user).
Output Example:
Code:
Question 4: Write a program to carry out the stated task (An output example is given)
Future Value
: If P dollars (called the principal) is invested at r% interest compounded annually, then the future value of the investment after n years is given by the formula
Calculate the future value of an investment after the user enters the principal, interest rate, and number of years.
Output example:
Note: You will be able to add “$” and “thousands separator” after the lecture 1/24. Your solution might be without these ones (i.e., Future value: 1157.63).
Code:
Question 5: Length Conversion:
Write a program to convert a U.S. Customary System length in miles, yards, feet, and inches to a Metric System length in kilometers, meters, and centimeters. After the numbers of miles, yards, feet, and inches are entered, the length should be converted entirely to inches and then divided by 39.37 to obtain the value in meters. The int function should
be used to break the total number of meters into a whole number of kilometers and meters. The number of centimeters should be displayed to one decimal place. The needed formulas are as follows:
Output Example:
SOLUTION
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help