Write a driver program that tests all the methods

Assignment Help C/C++ Programming
Reference no: EM131608886

Question: Write a Temperature class that has two instance variables: a temperature value (a floating-point number) and a character for the scale, either C for Celsius or F for Fahrenheit. The class should have four constructor methods: one for each instance variable (assume zero degrees if no value is specified and Celsius if no scale is specified), one with two parameters for the two instance variables, and a no-argument constructor (set to zero degrees Celsius). Include the following:

(1) two accessor methods to return the temperature-one to return the degrees Celsius, the other to return the degrees Fahrenheit-use the following formulas to write the two methods, and round to the nearest tenth of a degree:

DegreeC = 5(degreeF - 32)/9

DegreeF = (9(degreesC)/5) + 32;

(2) three mutator methods: one to set the value, one to set the scale ( F or C ), and one to set both;

(3) three comparison methods: an equals method to test whether two temperatures are equal, one method to test whether one temperature is greater than another, and one method to test whether one temperature is less than another (note that a Celsius temperature can be equal to a Fahrenheit temperature as indicated by the above formulas); and

(4) a suitable to String method. Then write a driver program (or programs) that tests all the methods. Be sure to use each of the constructors, to include at least one true and one false case for each of the comparison methods, and to test at least the following temperature equalities: 0.0 degrees C = 32.0 degrees F, -40.0 degrees C = -40.0 degrees F, and 100.0 degrees C = 212.0 degrees F.

Reference no: EM131608886

Questions Cloud

How is this scene an example of cultural studies : Do the images show any women of color? 2. Are women encouraged to work outside the home - Are women encouraged to join the military
Different sound systems could he advertise : If an owner at a stereo store has 10 different types of cd players, 9 different types of receivers and 8 different types of speakers and he can make.
Analyze the concept of patients rights : Summarize the overarching connections between patients' rights and patients' resulting responsibilities concerning HIV / AIDS.
Which is the first step in the investigation of child abduct : Mechanical fire-setting devices are used by an arsonist for which of the following reasons
Write a driver program that tests all the methods : Write a Temperature class that has two instance variables: a temperature value (a floating-point number) and a character for the scale, either C for Celsius.
How can the us create confidence in light of these reactions : How can the American public's reactions to a terrorist attack affect the United States' partner nations' confidence in the US economy
Natural and a man-made emergency : What is the difference between a natural and a man-made emergency? Does the preparedness differ and how?
What is your role in the decision-making processes : What is your role in the decision-making processes that serve to establish an organizational climate oriented to meet business goals?
Write test program that test each method in class definition : Redefine the class Date in Display 4.13 so that the instance variable for the month is of type int instead of type String. None of the method headings.

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Create program that uses functions and reference parameters

Create program that uses functions and reference parameters, and asks user for the outside temperature.

  Write a program using vectors and iterators

Write a program using vectors and iterators that allows a user to maintain a personal list of DVD titles

  Write the code required to analyse and display the data

Calculate and store the average for each row and column. Determine and store the values for the Average Map.

  Write a webservices application

Write a webservices application that does a simple four function calculator

  Iimplement a client-server of the game

Iimplement a client-server version of the rock-paper-scissors-lizard-Spock game.

  Model-view-controller

Explain Model-View-Controller paradigm

  Design a nested program

How many levels of nesting are there in this design?

  Convert celsius temperatures to fahrenheit temperatures

Write a C++ program that converts Celsius Temperatures to Fahrenheit Temperatures.

  Evaluate and output the value in the given base

Write C program that will input two values from the user that are a Value and a Base with which you will evaluate and output the Value in the given Base.

  Design a base class shape with virtual functions

Design a base class shape with virtual functions

  Implementation of classes

Implementation of classes Chart and BarChart. Class barChart chould display a simple textual representation of the data

  Technical paper: memory management

Technical Paper: Memory Management, The intent of this paper is to provide you with an in depth knowledge of how memory is used in executing, your programs and its critical support for applications.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd