Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

5.17 Lab lesson 6 it is very important that you look at the output from all of the tests. You should then try and fix

5.17 Lab lesson 6

it is very important that you look at the output from all of the tests. You should then try and fix all of the problems in your IDE and then upload the updated code to zyBooks/zyLabs.

C++ requirements

All values must be read in as type double and all calculations need to be done using type double.

Failure to follow the C++ requirements could reduce the points received from passing the tests.

General overview

This program will convert a set of temperatures from Fahrenheit to Celsius.

Your program will be reading in three double values. The first values are starting and ending temperatures. The third value is the increment value. There is no prompt for the input. There is an error message that can be displayed. This is discussed later.

You need to display output for all of the values between the starting and ending values. First two values are temperatures in Fahrenheit. You need to display all of the values from the first temperature to the last temperature. You increment from one temperature to the next by the increment value (the third value you read in). You need to convert these temperatures to Celsius. You need to output the temperatures as both Fahrenheit and Celsius. The numbers should be 18 characters wide with 5 digits of precision and need to be in fixed format. Do not use tab characters (\t) to output the values.

The headings are also required (see the sample output below).

The conversion from Fahrenheit to Celsius is:

celsius = (fahrenheit - 32) / 1.8

Here is a sample run with valid input:

-30 100 20 

The output would be:

 Fahrenheit Celsius -30.00000 -34.44444 -10.00000 -23.33333 10.00000 -12.22222 30.00000 -1.11111 50.00000 10.00000 70.00000 21.11111 90.00000 32.22222 

For data validation you need to make sure the first number read in is less than or equal to the second number. The third number read in must be greater than 0. If this is not the case you need to output the following message and read in three new values:

Starting temperature must be <= ending temperature and increment must be > 0.0 

The above message is all one line of output.

You need to keep reading in values and outputting messages until the values are all valid.

Using the following input :

40 30 5 30 40 -5 30 40 5 

We get the output:

Starting temperature must be <= ending temperature and increment must be > 0.0 Starting temperature must be <= ending temperature and increment must be > 0.0 Fahrenheit Celsius 30.00000 -1.11111 35.00000 1.66667 40.00000 4.44444 

Depending on the value for the increment the ending temperature may not be reached. You need to display the temperatures where the value of the Fahrenheit temperature is less than or equal to the ending temperature.

Consider this input:

100.5 110.4 5 

The valid output will be:

 Fahrenheit Celsius 100.50000 38.05556 105.50000 40.83333 

The last Fahrenheit temperature output is 105.5. The next one would have been 110.5, but this is more than the ending temperature of 100.4. This is not an error condition. The output would be as above.

Think about what other tests cases are needed? Do we cover all possible input problems or valid types of input values?

Failure to follow the requirements for lab lessons can result in deductions to your points, even if you pass the validation tests. Logic errors, where you are not actually implementing the correct behavior, can result in reductions even if the test cases happen to return valid answers. This will be true for this and all future lab lessons.

Expected output

There are eight tests. Each test will have a new set of input data. You must match, exactly, the expected output.

You will get yellow highlighted text when you run the tests if your output is not what is expected. This can be because you are not getting the correct result. It could also be because your formatting does not match what is required. The checking that zyBooks does is very exacting and you must match it exactly. More information about what the yellow highlighting means can be found in course "How to use zyBooks" - especially section "1.4 zyLab basics".

Compile command

g++ lesson6part2.cpp -Wall -Wextra -Wuninitialized -pedantic-errors -Wconversion -o a.out

We will use this command to compile your code

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_2

Step: 3

blur-text-image_3

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

Database Concepts International Edition

Authors: David M. Kroenke

6th Edition International Edition

0133098222, 978-0133098228

Students also viewed these Databases questions

Question

=+b. Does your method result in paired data?

Answered: 1 week ago

Question

Explain demotion as an alternative to termination.

Answered: 1 week ago

Question

b. Will new members be welcomed?

Answered: 1 week ago

Question

a. What is the purpose of the team?

Answered: 1 week ago