Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Hi i'd like help with this program please. The bolded Temperature towards the bottom is a UML diagram. Please and thanks. With what you have

Hi i'd like help with this program please.

The bolded Temperature towards the bottom is a UML diagram. Please and thanks.

With what you have learned in Chapter 6 about designing, developing and using a class, this project will provide you an opportunity to put it all together. In this project you will develop a simple class that has a field, several constants, getter and setter methods and several service methods. You will also develop a demo/driver program that will demonstrate the functionality of the class.

Problem Description: In this project you will develop a program that utilizes a Temperature class that models a Temperature entity. You need to write a Temperature class as defined in the following UML diagram:

This Temperature class will have a field called fTemp, which will hold a Fahrenheit temperature. It will also have two named constants (FREEZING_POINT and BOILING_POINT) that hold the temperature at which water boils (212.0F) and freezes (32.0F) on the Fahrenheit scale.

This Temperature class will have a no- argument constructor method that will place a default 0.0 value into the fTemp data field.

It will have a getter and setter method for the fTemp field.

It will also have several service methods.

A method that calculates and returns the fTemp to the Celsius scale.

A method that calculates and returns the fTemp to the Kelvin scale.

A method that returns the Fahrenheit freezing point for water

A method that returns the Fahrenheit boiling point for water

A method that returns True or False if the fTemp is at or above the boiling

point.

A method that returns True or False if the fTemp is at or below the freezing

point.

The formula to convert a Fahrenheit temperature to a Celsius temperature is as follows:

Celsius = (5.0 / 9.0) x (Fahrenheit temperature 32)

The formula to convert a Fahrenheit temperature to a Kelvin temperature is as follows:

Kelvin = ((5.0 / 9.0) x (Fahrenheit temperature 32)) + 273 Page 1 of 3

Temperature

- FREEZING_POINT : double - BOILING_POINT : double - fTemp: double

+ Temperature() + setFTemp( fahrenheitTemp : double) : void + getFTemp() : double + getCelsius() : double + getKelvin() : double + getFreezingPoint() : double + getBoilingPoint() : double + isTemperatureBoiling() : boolean + isTemperatureFreezing() : boolean

After writing the Temperature class, write a demo/driver program, called TemperatureDemo that demonstrates a temperature object created from the Temperature class. The actions in the demo/driver programs main method need to be the following:

create a Temperature object using an object instantiation statement that passes no arguments to the constructor method; you may name the object reference variable temperature

using a Scanner object ask the user for a Fahrenheit temperature

set the temperature objects fTemp value by calling the setter method

and passing to it the Fahrenheit temperature entered by the user.

call the temperature objects getCelsius() method and display the

returned Celsius value as follows:

 Temperature 32.0F converted to Celsius is: 0.0C 

call the temperature objects getKelvin() method and display the returned Kelvin value as follows:

Temperature 32.0F converted to Kelvin is: 273.0K

call the temperature objects getBoilingPoint() method to get the Fahrenheit boiling point temperature and display the returned temperature at which water boils as follows:

 Water boils at: 212.0F 

call the temperature objects getFreezingPoint() method to get the Fahrenheit freezing point temperature and display the returned temperature at which water freezes as follows:

 Water boils at: 32.0F 

call the temperature objects isTemperatureBoiling() method and if the returned value is true display the following; otherwise display nothing.

 The temperature of 212.0F is at or above boiling. 

call the temperature objects isTemperatureBoiling() method and if the returned value is true display the following; otherwise display nothing.

 The temperature of 32.0F is at or below freezing. 

NOTE: Dont forget to include Documentation comments: o file header comments for both java source code files o variable comments for variables in all methods in the demo/driver

program o javadoc comments for each of the methods in the Temperature class.

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

Intelligent Information And Database Systems Asian Conference Aciids 2012 Kaohsiung Taiwan March 19 21 2012 Proceedings Part 3 Lnai 7198

Authors: Jeng-Shyang Pan ,Shyi-Ming Chen ,Ngoc-Thanh Nguyen

2012th Edition

3642284922, 978-3642284922

More Books

Students also viewed these Databases questions