My goal is to Write a utility class called Sleep, containing a static method called iqLoss. The iqLoss method should take a single parameter: an integer number representing the number of sleep hours missed on a given night. Then return an integer representing the IQ drop experienced as a result of that sleep deprivation. I dont know what the problem is since I am just beginner in Java. I am using an ide called "Codio" for my class so there are some things that I am unable to use with it, I am not aware of the limitations of the IDE. I have posted the main and class below, any tips would be very appreciated.
public class Sleep{
public static int iqLoss(){
int iq;
int totaliqloss;
if(iq >= 2){
totaliqloss = totaliqloss + 2;
}else if(iq<=2){
totaliqloss = totaliqloss + 1;
}
return totaliqloss;
}
}
public class SleepCalc {
public static void main(String[] args) {
int iq;
int normalsleep;
System.out.println("What is your IQ (when fully rested)");
iq = ConsoleIO.readInt();
System.out.println("How many hours do you noramlly get");
normalsleep = ConsoleIO.readInt();
System.out.println("How many hours did you get last night?");
int sleep;
sleep = ConsoleIO.readInt;
sleep = normalsleep - sleep;
sleep = Sleep.iqLoss();
System.out.println("How many hours did you get the night before last?");
int sleep2;
sleep2 = ConsoleIO.readInt;
sleep2 = normalsleep - sleep2;
sleep2 = Sleep.iqLoss();
System.out.println("How many hours did you get the night before the night before last?");
int sleep3;
sleep3 = ConsoleIO.readInt;
sleep3 = normalsleep - sleep3;
sleep3 = Sleep.iqLoss();
iq = iq - sleep - sleep2 - sleep3;
}
}
SleepCalc.java:21: error: cannot find symbol
sleep = ConsoleIO.readInt;
^
symbol: variable readInt
location: class ConsoleIO
SleepCalc.java:27: error: cannot find symbol
sleep2 = ConsoleIO.readInt;
^
symbol: variable readInt
location: class ConsoleIO
SleepCalc.java:33: error: cannot find symbol
sleep3 = ConsoleIO.readInt;
^