Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create a class like the TemperatureConversion class, but for converting angles between degrees and radians. Create a client class to test it. class TemperatureConversion {

Create a class like the TemperatureConversion class, but for converting angles between degrees and radians. Create a client class to test it.

class TemperatureConversion { final static double CELC_FAHREN_RATIO = 9.0/5; final static int FAHREN_FREEZE_POINT = 32; // takes as an argument (input) the temperature in celcius (as a double) // returns (outputs) the temperature in fahrenheit (as a double) static double celcToFahren(double tempInCelc) { return tempInCelc * CELC_FAHREN_RATIO + FAHREN_FREEZE_POINT; } // argument : temperature in fahrenheit, as a double // return : temperature in celcius, as a double static double fahrenToCelc(double tempInFahren) { // TODO return 0; // replace this return with a correct conversion } }

class TemperatureConversionClient { public static void main(String[] args) { double tempInCelcius = 100; double tempInFahrenheit = TemperatureConversion.celcToFahren( tempInCelcius ); System.out.println("Celcius : " + tempInCelcius); System.out.println("is equivalent to"); System.out.println("Fahrenheit : " + tempInFahrenheit); } }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions