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

  Write a function bucketsort that takes an integer array and

A bucket sort begins with an one dimensional array of positive integers to be sorted, and a two dimensional array of integers with rows subscripted from 0 to 9 and columns subscripted from 0 to n - 1 where n is the number of values in the array to be..

  Your program should include two functions

Your program should include two functions. Function celsius_at_depth should compute and return the Celsius temperature at a depth given in kilometers. Function fahrenheit should convert a Celsius temperature to Fahrenheit.

  Evaluate the circumference of a circle

Write a program that will call a function to calculate the area of a circle, and call another function to calculate the circumference of a circle.

  Write a function called gimmeindex that returns the index

Write a function called gimmeIndex() that returns the index of the largest value stored in an array-of-doubles. Demonstrate the function in a program that passes the name and size of the array to your function.

  Make header for the entire program

C code that I would like you to document it and make header for the entire program and for each function as well as make short comment inside the code. pay attention to the marking scheme Code Commenting:

  Prepare a program to add the specific numbers

Write a program that will read in 5 numbers and add 10 to the first number, 20 to the second number, and 30 to the third number, 40 to the fourth and 50 to the 50th.

  Write a program that asks the user for a positive integer

Write a program that asks the user for a positive integer N and generates the Nth Fibonacci number.

  Implementation of classes

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

  Compare the running time of two versions of the insertion

implement Uniform Random Number generator and Generate 1000 Random number between 0 an 10000. Try to use insertion sort to sort them. Compare the running time of two versions of the insertion sort.

  Computer programming using c language lab

Computer programming using c language lab

  Read the matrix from a file called data.txt.

I need to modify this code, instead of asking the user for the matrix, it will read the matrix from a file called Data.txt.

  Write a program manipulating a 2-dimensional array

Write a program manipulating a 2-dimensional array. Create constants to represent your number of students and number of assignments.

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