Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Java please The kelvin is the base unit of temperature in the International System of Units (SI), having the unit symbol K. It is named

Java please

The kelvin is the base unit of temperature in the International System of Units (SI), having the unit symbol K. It is named after the Belfast-born, Glasgow University engineer and physicist William Thomson, 1st Baron Kelvin (18241907). It uses absolute zero as its null point. The Celsius scale, also known as the centigrade scale, is a temperature scale used by the International System of Units (SI). The Celsius scale is based on 0 C for the freezing point of water and 100 C for the boiling point of water at 1 atm pressure. Kelvin temperatures and Celsius temperatures are related. This means that a temperature difference of one degree Celsius and that of one kelvin are exactly the same. On the Fahrenheit scale, the freezing point of water is 32 degrees Fahrenheit (F) and the boiling point is 212 F (at standard atmospheric pressure). There are three conversion methods. toCesius() converts the this temperature to a Celsius value and returns it. toKelvin () converts the this temperature to a Kelvin value and returns it. toFahrenheit() converts the this temperature to a Fahrenheit value and returns it. These conversions do not change the value of the this. There will be a method for each of the arithmetic operations. For divide it will be divide(double), which returns a temperature in the scale of the this. For add it will be add(Temperature), which returns a temperature in the scale of the this. For Subtract it will be subtract(Temperature), which also returns a temperature in the scale of the this. The value of this is not changed in these three methods. There are two boolean methods. Method equals(Temperature) tests the value of the parameter and this and returns true it they are equal., Method greaterThan(Temperature) compares the this with the parameter and returns true if this is greater than the parameter. There should be a read() method and a toString() method in your class. Remember methods add, subtract, and divide and the three conversion methods all return a Temperature. Include at least two constructors: a default constructor and an explicit constructor. You must use a private helper method called set() that takes the parameters of the constructor and tests for appropriate values for each possible scale. The set method is a void method. This private set() method can be used to guarantee temperature values are in the proper range. The add(), subtract(), and divide() methods can call the constructor which calls the set() method. The set method will check the degree value and if it is in the proper range a new Temperature will be made to be returned by the add() method, subtract() method, and divide() method. A switch statement should be used throughout this class when choosing between C, F, and K. Absolute zero for Kelvin is 0, for Fahrenheit -459.67, and for Celsius -273.15. Your program must guarantee this absolute value is not violated. For the equals() method consider changing the this temperature and the parameter temperature to the same scale and then testing the degree value for equality.

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

Database Design Query Formulation And Administration Using Oracle And PostgreSQL

Authors: Michael Mannino

8th Edition

1948426951, 978-1948426954

More Books

Students also viewed these Databases questions

Question

explain the term elevation of privilege

Answered: 1 week ago