Description
Exercise 1: vim Tutorial (10 points)
Complete the vim Tutorial under Piazza->Resources.
File to submit to Gradescope: rain.txt
Problem 1: annualincome.c (30 points, 3 per test case)
Write a program that reads in an hourly wage and calculates the total income over the
course of an entire year assuming 40 hours of work a week every week of the year. Example output:
[rsgysel@pc17 ˜]$ ./annualincome
What is your hourly wage? 5.00
Your total income over a year is 10400 dollars and 0 cents
[rsgysel@pc17 ˜]$ ./annualincome
What is your hourly wage? 18.33
Your total income over a year is 38126 dollars and 40 cents
File to submit to Gradescope: annualincome.c
∗Last updated January 8, 2017
1
Problem 2: finalgrade.c (30 points, 3 per test case)
Write a program that calculates your final grade. Your program will read your current
grade (out of 100 points), the value of the final as a percentage, and your final exam score
(out of 100 points) from stdin and compute your final grade as a percent. All numbers
should be whole numbers. Round up fractional final grades. Example output:
[rsgysel@pc17 ˜]$ ./finalgrade
What is your current grade? 76
How much is the final worth? 20
What is your final exam score? 96
Your final grade is 80%
[rsgysel@pc17 ˜]$ ./finalgrade
What is your current grade? 100
How much is the final worth? 20
What is your final exam score? 77
Your final grade is 95%
File to submit to Gradescope: finalgrade.c
Problem 3: primerib.c (30 points, 3 per test case)
Chef John Mitzewich of Food Wishes fame recommends the following method to cook
prime rib, which he affectionately calls “Method X”1
. You have a prime rib that weighs
x pounds. Chef Mitzewich orders you to cook your rib at 500 degrees Fahrenheit for 5x
minutes, turn off the oven (do not open the door), and let the rib continue to cook in
the oven for 2 hours. Write a program that outputs the total time that a rib weighing x
pounds is in the oven with the following format:
Your rib will be in the oven for h hours, m minutes, and s seconds.
You must have h ≥ 0, 0 ≤ m ≤ 59, and 0 ≤ s ≤ 59. Example output:
[rsgysel@pc17 ˜]$ ./primerib
How many pounds is your prime rib? 3.75
Your rib will be in the oven for 2 hours, 18 minutes, and 45 seconds.
[rsgysel@pc17 ˜]$ ./primerib
How many pounds is your prime rib? 5.35
Your rib will be in the oven for 2 hours, 26 minutes, and 45 seconds.
File to submit to Gradescope: primerib.c
1No, really, this is a recipe, and it works.
2