Write class to represent temperatures in degree and celsius

Assignment Help Programming Languages
Reference no: EM1364350

Write a Temperature class that represents temperatures in degrees in Celsius, Fahrenheit and Kelvin. Use a floating-point number for the temperature and a character (type char) for the scale: 'C' for Celsius, 'F' for Fahrenheit and 'K' for Kelvin. The class should have

a) Four constructors: one for the degrees, one for the scale, one for both the degrees and scale, and a no-argument constructor. For each of these constructors, assume zero degrees if no value is specified and Celsius if no scale is given.
b) Three accessor methods: one to return the temperature in degrees Celsius, one to return the temperature in degrees Fahrenheit, one to return the temperature in degrees Kelvin.

For conversion between scales you can use the following formulas:
Celsius = 5/9 x (Fahrenheit - 32)
Kelvin = Celsius + 273.15

c) Three set methods: one to set the temperature, one to set the scale and one to set both.
d) Three comparison methods: one to test whether two temperatures are equal, one to test whether one temperature is greater than the other and one to test whether one temperature is less than the other.
e) a toString method: to display the temperature and scale. The output should look like 32° C (You can copy the degree sign from here to put in your code)

Write a test program to demonstrate your class. Be sure to use all of your methods in the test program.

Reference no: EM1364350

Questions Cloud

Describe in details of the social responsibilities : Explain the communication and Recommend one way the organization can improve its social responsibility. Describe in details of the social responsibilities.
How fast does it move after the bullet emerges : David is driving a steady 24 when he passes Tina, who is sitting in her car at rest. Tina begins to accelerate at a steady 2.70 at the instant while David passes. How far does Tina drive before passing David.
Explain what forces are driving changes : Explain What forces are driving changes in the movie rental industry and are the combined impacts of these driving forces likely to be favorable
Calculate and graph the money growth rate : As a junior financial analyst in a brokerage firm, you have been asked by your boss to show the usefulness of the World Wide Web as a convenient resource for financial research.
Write class to represent temperatures in degree and celsius : Write a Temperature class that represents temperatures in degrees in Celsius, Fahrenheit and Kelvin. Use a floating-point number for the temperature and a character (type char) for the scale.
Licensing of health care professionals : Physicians and nurses are required by states to meet specific licensing requirements before providing care to the public; however, other health care workers are required to be licensed.
Organizing and delegating in a shoe store : A note to call Mary (salesclerk) about vacation schedule and a notice that the mall will be changing hours for the upcoming holiday and requesting notice of store plans.
Explain how would the bonus distribution : Explain How would the bonus distribution to the four managers (new car, used car, service and parts) change for the deal described in the case
What good or service does the firm sell : What good or service does the firm sell and How should the firm alter the price of the good or service to increase revenues?

Reviews

Write a Review

Programming Languages Questions & Answers

  Write program that inputs integers from keyboard

Write a program that inputs 20 integers from the keyboard and stores them in an array called A. You are then To: Output the numbers in the original input order.

  Write program that takes input arithmetic expression

Write a program that takes as input an arithmetic expression. The program outputs whether the expression contains matching grouping symbols.

  Software system to manage records of patients

A software system is to be developed to manage the records of patients who enter a clinic for treatment. The records include records of the all regular patient monitoring.

  Write program to calculate how much person earns

Write a program that calculates how much a person earns in a month if the salary is one penny the first day, two pennies the second day.

  Program for class quiz to implement measurable interface

State a class Quiz to implement Measurable interface. A quiz has a score and a letter grade (such as B+).

  Program has function named presentvalue for calculations

Write a program that has a function named presentValue that performs this calculation. The function should accept the future value, annual interest rate, and number of years as arguments.

  Design a benefits election system

Individual project for this course is in form of Service Request from Huffman Trucking. It is essential for student to access Service Request: SR-ht-001. Design a Benefits Election System.

  Program to enter up to 20 integers in the array of long

Write down a program which asks user in order to enter up to 20 integers in the array of longs.The program must utilize the function Find_It() in order to situate the integer within the array.

  Write a program to read student data from standard input

Write a program to read student data from standard input, sort it by last name / first name, and print result to standard output.

  Develop vision system for building high safe mobile robot

You are tasked to develop a vision system for building a high safe mobile robot. In particular, your system should give a warning alarm when there are a danger of colliding (at certain distance) with a pedestrian.

  Create design of very simple racing game

Create a very simple racing game of your own design. Making a game from the ground up is a lot of effort, so let's keep things basic.

  Write program using while loop to output squares of integers

Write a program that uses while loop to perform the following steps:Output the sum of all the even numbers between firstnum and secondnum inclusive. Output all the numbers and their squares between firstnum and secondnum inclusive.

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