I have a little problem, I dont know if it's my compiler or if it's something else that is wrong.
I want my program, to show one question, and then after I have answered it, the program will display my other question.
import java.io.*;
class BallsPerKid {
public static void main(String args[])
{
InputStreamReader reader = new InputStreamReader(System.in);
BufferedReader buf = new BufferedReader(reader);
double balls;
double Kids;
double ballsPerKid;
try{
System.out.print("How many kids?");
Kids = Integer.parseInt(buf.readLine());
System.out.print("How many balls?");
balls = Integer.parseInt(buf.readLine());
ballsPerKid = balls / Kids;
System.out.println("Each kid gets:");
System.out.print(ballsPerKid);
System.out.print(" balls.");
}catch(Exception e){
e.printStackTrace();
}
}
}
I have asked some of my friends about this as well, and some say that it works with one question at a time and some get the problem I have.
Im running Windows xp and i'm using the compiler j2se,JCreator 4.5.

New Topic/Question
Reply




MultiQuote





|