Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Question: Code a program in temps.c that does the following: 1.Before the declaration of main define NUMS as 3: #define NUMS 3 2.Print the title

Question:

Code a program in temps.c that does the following:

1.Before the declaration of main define NUMS as 3: #define NUMS 3

2.Print the title of the application.

>---=== IPC Temperature Analyzer ===---<

3.Using a for loop, prompt the user to enter the high and low values for each of NUMS days. The values entered must be between -40 and 40, and high must be greater than low.

Print the following messages:

>Enter the high value for day 1: < (or day 2, or day 3)

*Read the high value.

>Enter the low value for day 1: < (or day 2, or day 3)

*Read the low value.

IMPORTANT:You may only declare two (2) int type variables for the high and low values

4.Use a nested while (or do-while) loop to analyze the results, high must be greater than low, high must be less than 41, low must be greater than -41

*If any entry is incorrect, prompt the user to enter again until the entries pass the tests:

> Incorrect values, temperatures must be in the range -40 to 40, high must be greater than low. <

Then prompt again for the high and low temperatures for the day.

OUTPUT EXAMPLE WITH ERRORS HANDLED (use this data for submission)

---=== IPC Temperature Analyzer ===--- Enter the high value for day 1: 8

Enter the low value for day 1: -2 Enter the high value for day 2: 41 Enter the low value for day 2: -4

Incorrect values, temperatures must be in the range -40 to 40, high must be greater than low.

Enter the high value for day 2: 9

Enter the low value for day 2: -4 Enter the high value for day 3: 5 Enter the low value for day 3: 11

Incorrect values, temperatures must be in the range -40 to 40, high must be greater than low.

Enter the high value for day 3: 11

Enter the low value for day 3: 5

The average (mean) temperature was: 4.50

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Financial management theory and practice

Authors: Eugene F. Brigham and Michael C. Ehrhardt

12th Edition

978-0030243998, 30243998, 324422695, 978-0324422696

Students also viewed these Programming questions