
Write a program that makes use of a class called Degrees that implements the following doublemethods as per the UML class
Method celsius returns the Celsius equivalent of a given Fahrenheit temperature
Method fahrenheit returns the Fahrenheit equivalent of a given Celsius temperature
Method displayTable should use the above methods to prints charts showing:
The Fahrenheit equivalents of all Celsius temperatures from 0 to 100 degrees in 4 degree intervals
The Celsius equivalents of all Fahrenheit temperatures from 32 to 212 degrees in 10 degree intervals
Both columns in each chart should be printed to one decimal place
Print the charts in a neat tabular format that minimizes the number of lines of output while remaining readable

Here is an example of Temperature Conversion where we have converted Celcius to Fahrenheit and vice versa. For this, we have create three functions celcius(), fahrenheit() and display table which display the conveted values in the form of chart.
import java.util.*;
import java.text.*;
class Degrees
{
public static double fahrenheit(int temp) {
return (1.8 * temp) + 32;
}
public static double celsius(int temp) {
return (temp - 32) / 1.8;
}
public static void displayTable(){
DecimalFormat df=new DecimalFormat("##.#");
System.out.println("Celcius (C) Fahrenheit (F)");
for(int i=0;i<=100;i+=4){
System.out.println(i+"\t | "+df.format(fahrenheit(i)));
}
System.out.println("Fahrenheit (F) Celcius (C) ");
for(int i=32;i<=212;i+=10){
System.out.println(i+"\t | "+df.format(celsius(i)));
}
}
public static void main(String[] args)
{
displayTable();
}
}

thanks :)
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.