+ 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.

29th Nov 2017, 11:36 PM
8BitHeals
8BitHeals - avatar
12 Respuestas
+ 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. ;)
30th Nov 2017, 1:40 AM
AgentSmith
+ 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
30th Nov 2017, 1:42 AM
8BitHeals
8BitHeals - avatar
+ 1
Cool. Good luck to you on that! Post it up when you're done so we can check it out.
30th Nov 2017, 12:52 AM
AgentSmith
+ 1
Once i figure it out i will.
30th Nov 2017, 12:53 AM
8BitHeals
8BitHeals - avatar
+ 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?
30th Nov 2017, 1:06 AM
AgentSmith
+ 1
Not far really...it is an assignment for school
30th Nov 2017, 1:07 AM
8BitHeals
8BitHeals - avatar
+ 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?
30th Nov 2017, 1:11 AM
AgentSmith
+ 1
i have to write both classes
30th Nov 2017, 1:13 AM
8BitHeals
8BitHeals - avatar
+ 1
and its due tomorrow night
30th Nov 2017, 1:13 AM
8BitHeals
8BitHeals - avatar
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
30th Nov 2017, 5:28 AM
8BitHeals
8BitHeals - avatar
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
30th Nov 2017, 5:33 AM
8BitHeals
8BitHeals - avatar
0
im stuck and need a little assistance for the next part
30th Nov 2017, 5:33 AM
8BitHeals
8BitHeals - avatar