stress is when you wake up screaming and realize you never fell asleep
Averaging three integers, WITH COMMENTS, you lucky people.(And unlike those people who cry to Ellen, I had to do this on my fucking own.)
import cs1.Keyboard;//importing keyboard class
public class RequestReturn
{
public static void main(String [] args)
//declaring main method and parameters
{
int num1;//declaring first variable
int num2;//declaring second variable
int num3;//declaring third variable
double y;//declaring fourth variable
System.out.println("Please enter a number: ");//requests info from user
num1 = Keyboard.readInt();//storing value supplied
System.out.println("Please enter a number: ");
num2 = Keyboard.readInt();
System.out.println("Please enter a number: ");
num3 = Keyboard.readInt();
Compute solve123 = new Compute();//invokes method
y=solve123.average(num1,num2,num3);
System.out.println("The average of these numbers is " + y);//printing average from screen
}
}
0 Comments:
Post a Comment
<< Home