Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create the following 5 java classes- WindChill Temperature # degrees : double get/set + Temperature(double) + getKelvin): double + getCelsius(): double + getFahrenheit(): double +

Create the following 5 java classes-

image text in transcribed

image text in transcribed

WindChill Temperature # degrees : double get/set + Temperature(double) + getKelvin): double + getCelsius(): double + getFahrenheit(): double + toString(): String + windChill(Temperature, double): Fahrenheit skin Temperature(Temperature, double): Celsius + frostbite Warning(Temperature, double) : void + main(String(): void Kelvin Celsius Fahrenheit Kelvin (double) Celsius(double) Fahrenheit(double) Temperature Instead of doing all the work, this version of Temperature.java should be a relatively bare base class. It stores the protected attribute degrees, but doesn't handle any units or conversions. Its four get* () methods can all return the same value, degrees; while toString() returns shows the value in the following format: "13.37 Degrees" correct to two decimal places with no unit specified. Now write three subclasses, whose get*() methods each perform the appropriate unit conversions separately: Kelvin.java: C = K -273.15 F=1.8 x K - 459.67 Celsius.java: K=C + 273.15 F=1.8 x C +32 Fahrenheit.java: K= 5/9 X (F + 459.67) C =5/9 (F-32) For each class's constructor, make sure that the specified temperature is greater than 0K. If it is below absolute zero, set it to the equivalent of Ok in the relevant unit. Also, each class should also override Temperature.java's toString() method so that it appends a unit to the end of the returned text, (e.g., "262.80 Degrees Kelvin") Wind Chill Write a modified version of Windchill.java to make use of the newly created subclasses of Temperature: Modify windChill() to return an instance of Fahrenheit, rather than Temperature. Note that the argument can still have the type Temperature, since every subclass will support the getFahrenheit() method. Fax = 35.74+0.6215-TP - 35.75 - ( mph)^16 +0.4275 - Tp (Vmph)016 (1) Modify skinTemperature() to return an instance of Celsius. Again, its input argument still has the base type, Temperature. Tfinal = (0.1. Tc -2.7883) - In(V) +0.2977. TC +19.874 Make sure that frostbiteWarning() still works with the new class structure. Tc -11.5 Enter the temperature unit [K/C/F]> F 6 Enter the wind speed (mph)> 25 # Wind Chill Temperature: -39.469 Degrees Fahrenheit 9 Final Skin Temperature: -10.482 Degrees Celsius 10 Extreme Danger! Get inside within 10 minutes to avoid freezing

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

Relational Database Design With Microcomputer Applications

Authors: Glenn A. Jackson

1st Edition

0137718411, 978-0137718412

More Books

Students also viewed these Databases questions