Homework #5 – Solution (C Programming for Beginners – OnLine)

$24.99 $18.99

Note: If you complete this (specially 5.1 and 5.2) and next homework, you will be much closure to your in designing your midterm project 5.1 Write a program, which will display the menu with 5 items. It will ask the use to give their choice. It will trap all possible errors and then print the…

5/5 – (2 votes)

You’ll get a: zip file solution

 

Description

5/5 – (2 votes)

Note: If you complete this (specially 5.1 and 5.2) and next homework, you will be much closure to your in designing your midterm project

5.1 Write a program, which will display the menu with 5 items. It will ask the use to give their choice. It will trap all possible errors and then print the result when correct input is provided before exiting the program.

Example user interface:

5.2 Write a program that will give the user prompt to enter two float (or double) values. If the values inputted are correct then display the inputted two values. If user enters characters instead of numbers or if they enter invalid numbers then the program will display the error message and ask the user to re-enter the correct values again. It only exits when the correct input is received and displayed.

Example user interface:

5.3 Here is a definition of integer array for 7 temperatures of the week. It is already initialized and there are variables declared for the minimum, maximum, total and average temperatures. These variables are going to be used to get the these values for this weekly temperature

int weeklyTemp[] = { 69, 70, 71, 68, 66, 71, 70 };

int i, max = 0, min = 0;

float total = 0, average;

Given the above definition, write the code to:

  1. Print the daily temperature (assume, first day Sunday), e.g.

The temperature on day 1 was 69:

  1. Find and print the minimum and maximum temperature of the week

  1. Calculate and print the average temperature of the week

Hint: Use loops (for or while)

Sample Output:

Homework #5 – Solution (C Programming for Beginners - OnLine)
$24.99 $18.99