+ 1
Write and test a Java class.
I have to write a ThermoTester class to test the Thermometer class. This must include prompting the user to enter the temperature change, reading in the temperature change, invoking the method to change temperature, and displaying the changed temperature in Fahrenheit, Celsius, and Kelvin.
12 ответов
+ 2
Get started on it and post up any errors you run in to. I'll be around for a bit and more than happy to help, but I'm not going to write your homework for you. If it's due tonight, it means they already taught you all of that stuff, but more importantly, you waited until the last minute instead of doing what you were suppose to do. ;)
+ 2
i have plenty of time to do it...it has to be done tomorrow night and i will post it up when i finish it...if you write it i wont learn anything
+ 1
Cool. Good luck to you on that! Post it up when you're done so we can check it out.
+ 1
Once i figure it out i will.
+ 1
I'm sure you'll get it. Let us know if you run into any problems and we can help. How far along are you with Java already?
+ 1
Not far really...it is an assignment for school
+ 1
Ah okay, gotcha. When is it due?
Also, are you having to write both classes or did they give you the class and want you to create the tester class?
+ 1
i have to write both classes
+ 1
and its due tomorrow night
0
public class Themometer
{
private int fahrenheit = 60;
public void setFahrenheit()
{
fahrenheit = 60;
}
public void setCelsius (int celsius)
{
celsius = (fahrenheit - 32)*(5/9);
}
public void setKelvin (int kelvin)
{
kelvin = (fahrenheit - 32)*(5/9) + 273;
}
public int getFahrenheit()
{return fahrenheit;
}
public int getCelsius()
{
return (fahrenheit - 32)*(5/9);
}
public int getKelvin()
{
return (fahrenheit - 32)*(5/9) + 273;
}
public int computeTemp(int tempChange)
{
int fahrenheit2 = fahrenheit + Math.min(fahrenheit,tempChange);
return fahrenheit2;
}
public int getDPCelsius (int tempChange)
{
int Celsius2 = (fahrenheit(celcius) + Math.min(fahrenheit,tempChange);
return Celsius2;
}
}
this is what i have for themometer
0
import java.util.*;
public class ThermoTester
{
private Themometer themometer1;
private int Temperature;
public void test()
{Scanner scan = new Scanner (System.in);
themometer1 = new Themometer();
System.out.println ("Fahrenheit = " + themometer1.getFahrenheit());
System.out.println ("Celsius = " +themometer1.getCelsius());
System.out.println ("Kelvin = " +themometer1.getKelvin());
System.out.println ("Please enter an integer to change the temperature in fahrenheit");
Temperature = scan.nextInt();
System.out.println ("Computing Temperatures");
System.out.println ("Fahrenheit = " +themometer1.computeTemp(Temperature));
System.out.println ("Celsius = " +(themometer1.getDPCelsius(Temperature)));
}
}
and this is what i have for the thermotester
0
im stuck and need a little assistance for the next part