Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Need this is c++ Make sure to create a header file for the class definitions, an implementation CPP file and a test program to exercise

Need this is c++

Make sure to create a header file for the class definitions, an implementation CPP file and a test program to exercise the functionality of your class. Also, turn in a UML diagram for the definition of the utility class. You can draw the diagram using any tool or you can draw on paper, scan and send the image file.

1. Create a UML diagram for the following class definition: The data fields for temperature in degrees Fahrenheit (a numeric value) and sky condition (a string value) which could be sunny, cloudy, or rainy. A default constructor to create any object with temperature of 72 degrees and sunny condition. A constructor that creates any object with a given temperature and weather condition. A function that converts the temperature in degrees Fahrenheit to degrees Celsius. Note that: Celsius = (Fahrenheit 32) * 5 / 9. Be careful about the issue with integer division. A function that converts the temperature in degrees Fahrenheit to degrees Kelvin. Note that: Kelvin = (Fahrenheit + 459.67) * 5 / 9. Be careful about the issue with integer division. A function that checks if the temperature in degrees Fahrenheit is between -30 and 120 degrees. If the temperature value is outside of this range, return false, otherwise, return true. 2. Write the definition of the class in C++. 3. Write a test class with a continuous loop that: a. Asks the user for temperature in degrees Fahrenheit and weather condition, b. Create an object, c. Use the functions and display the calculated values. d. Make sure to show the usage of your functions that convert temperature values. Of course, give the user an option to quit the loop. e. Show how to create an object using the default constructor. f. Show how you would create an array of 5 objects, assign values to the array elements and exercise your functions. g. Do not show temperature conversions, if the temperature value is invalid. Thoroughly test your code. The following is just a couple of example runs.

For example, Test case 1: Input: Temperature: 100 Weather: sunny Output: Temperature in degrees Fahrenheit:100 Temperature in degrees Celsius: 37.78 Temperature in degrees Kelvin: 310.93 Weather condition: sunny Temperature value is valid: Yes

Test case 2: Input: Temperature: 150 Weather: cloudy Output: Weather condition: cloudy Temperature value is valid: NO

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

Oracle Database 10g Insider Solutions

Authors: Arun R. Kumar, John Kanagaraj, Richard Stroupe

1st Edition

0672327910, 978-0672327919

More Books

Students also viewed these Databases questions