Question
In Java Please use these three classes as the starting points. Converter.java package csc142.packages.temp; public class Converter { public static double c2f(double value) { return
In Java
Please use these three classes as the starting points.
Converter.java
package csc142.packages.temp;
public class Converter {
public static double c2f(double value) { return 0; } } ------------------------------------
Double.java
package csc142.packages.string;
public class Double {
public static String format1(double value) { return ""; }
public static String format3(double value) { return ""; }
public static String format(double value, int places, int width) { return ""; } }
------------------------------------------------
TempTable.java
package csc142.packages;
public class TempTable {
public static void main(String[] args) { // print out headers System.out.println("Celsius Fahrenheit"); // print out values } }
Notice that all three of these classes are in named packages. You will need to create the appropriate directory structure when you down load them. Converter.java contains one method: c2f. Double.java contains three methods: format1, format3, and format. Temptable.java contains one method: main. There are JavaDoc comments for the three classes and for all the methods in these classes. Most of the methods have "dummy implementations" so that they will compile as downloaded. The application method has a brief skeleton of the code. Use these classes to create a table like the one that follows: Celsius Fahrenheit 0.0 32.000 10.0 50.000 20.0 68.000 30.0 86.000 40.0 104.000 50.0 122.000 60.0 140.000 70.0 158.000 80.0 176.000 90.0 194.000 100.0 212.000 Add a loop to Temptable.main to generate the Celsius values. Pass that into Converter.c2f to convert the value into Fahrenheit. Use Double.format1 to create String representations of the Celsius values and Double.format3 to create String representations of the Fahrenheit values. You can use these strings to generate the output within the loop in Temptable.main. Notes: The Double.format1 method shall format the double value into a string that is 6 characters wide with one digit after the decimal point. The Double.format3 method shall format the double parameter value into a string that is 12 characters wide with three digits after the decimal point. For the Minus version you can leave the "dummy implementation" in the three-parameter method Double.format. Here is the formula for Celsius to Fahrenheit conversion: 1 F = 1.8C + 32 Package up the three Java source code files into a jar file, from which they can be extracted, compiled, and run. Additionally, enhance main so that it prints out a blank line, followed by a Fahrenheit to Celsius conversion table, as shown below: Celsius Fahrenheit 0.0 32.000 10.0 50.000 20.0 68.000 30.0 86.000 40.0 104.000 122.000 60.0 140.000 70.0 158.000 80.0 176.000 90.0 194.000 100.0 212.000 50.0 Fahrenheit Celsius 32.0 0.000 52.0 11.111 72.0 22.222 92.0 33.333 112.0 44.444 132.0 55.556 152.0 66.667 172.0 77.778 192.0 88.889 212.0 100.000 Update the Converter class to include a static method f2c. Use Double.format to generate String representations for the output. Include appropriate JavaDoc comment with tags
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started