Hey guys I need help with in my code... I need to add a method that checks wheather the weather attributes are consistant or not.
thanks for the help heres my code...
import javax.swing.JOptionPane;
public class Week_eight_number_31
{
private int DefaultFarenheit = 70;
private String DefaultSky = "Sunny";
public Week_eight_number_31 (String Sky,
int Temp)
{
DefaultFarenheit = Temp;
DefaultSky = Sky;
}
public String getSKY ()
{
return DefaultSky;
}
public int getTEMPATURE ()
{
return DefaultFarenheit;
}
public void setSKY (String NewSky)
{
DefaultSky = NewSky;
}
public void setTEMP (int NewTemp)
{
if(NewTemp <= -51 || NewTemp >= 150)
JOptionPane.showMessageDialog(null,"The Tempature is above 150 degrees or below -50 Degrees");
else
{
DefaultFarenheit = NewTemp;
}
}
public static void main(String[]args)
{
System.out.println("============FARENHIET===========");
Week_eight_number_31 DAY1 = new Week_eight_number_31("Sunny", 70);
System.out.println(DAY1.getSKY()+": "+DAY1.getTEMPATURE()+" Degrees Farenheit =");
Week_eight_number_31 DAY2 = new Week_eight_number_31("Winter", 20);
System.out.println(DAY2.getSKY()+": "+DAY2.getTEMPATURE()+" Degrees Farenheit =");
Week_eight_number_31 DAY3 = new Week_eight_number_31("Rainy", 50);
System.out.println(DAY3.getSKY()+": "+DAY3.getTEMPATURE()+" Degrees Farenheit =");
Week_eight_number_31 DAY4 = new Week_eight_number_31("Summer", 110);
System.out.println(DAY4.getSKY()+": "+DAY4.getTEMPATURE()+" Degrees Farenheit =");
System.out.println("================================");
System.out.println("");
System.out.println("=============Celsius============");
double c1 = (DAY1.getTEMPATURE() - 32)*5/9;
double c2 = (DAY2.getTEMPATURE() - 32)*5/9;
double c3 = (DAY3.getTEMPATURE() - 32)*5/9;
double c4 = (DAY4.getTEMPATURE() - 32)*5/9;
System.out.println(DAY1.getSKY()+": "+c1+" Degrees Celsius =");
System.out.println(DAY2.getSKY()+": "+c2+" Degrees Celsius =");
System.out.println(DAY3.getSKY()+": "+c3+" Degrees Celsius =");
System.out.println(DAY4.getSKY()+": "+c4+" Degrees Celsius =");
System.out.println("================================");
}
}