C Assignment

Points: 50
Due by 12:35am on Friday, February 26 2016
Work can be re-submitted any time before the due date.
Turn in work

Question 1 (20 points)

Write a C program that lets a user calculate his or her Body Mass Index.  Body mass index (BMI) is a measure of body fat based on height and weight that applies to both adult men and women.  BMI is calculated using your height (in feet and inches) and weight (in pounds). The formula for BMI is

BMI = (weight in pounds * 703) / (height in inches) ^ 2

The result of the formula is then plugged into a table to determine a person's status:

BMICategory
greater than 29.9Obese
25.0 - 29.9Overweight
18.5 - 24.9Normal
less than 18.5Underweight

Your program will prompt the user for his or her height (get feet and inches) and weight, then output the appropriate BMI (to 1 decimal place) and the category. Use floating point precision.

View required output

Question 2 (5 points)

Write a C program that outputs "Hello World!"

View required output

Question 3 (10 points)

Write a C program that calculates interest for 1 year. Prompt the user for a dollar amount and an interest rate, then output the interest earned and the new principal. Format both these numbers to two decimal places.

View required output

Question 4 (15 points)

Write a program that accepts a file name from the command line and outputs the file contents to the screen. Also output the number of alphanumeric characters. Your program need only work with text files. If the user didn't supply the correct number of command line arguments, output the usage information and exit. If the file doesn't exist, output an error message.

View required output