T
the_transcriber
Hi, extreme noob here (less than one week of Java exerience, or any
programming exp)
This program i am writing from a book is suppose to ask the question
"How many gumballs? How mand kids? " , and then allow the user to
input the 2 answers. for example : 80 4
but it doesn't ask that question, it just answers without asking! any
help... ? this is from the Beginner Programming with Java for Dummies
- 2nd Edition. I typed it straight out of the book, and checked it
vary carefully. the output im currently gettins is... "Each kid gets 6
gumballs"
import java.util.Scanner;
class KeepingMoreKidsQuiet {
public static void main(String args[]) {
Scanner myScanner = new Scanner(System.in);
int gumballs;
int kids;
int gumballsPerKid;
System.out.print("How many gumballs? How many kids? ");
gumballs = myScanner.nextInt();
kids = myScanner.nextInt();
gumballsPerKid = gumballs / kids;
System.out.print("Each kid gets ");
System.out.print(gumballsPerKid);
System.out.println(" gumballs.");
}
}
programming exp)
This program i am writing from a book is suppose to ask the question
"How many gumballs? How mand kids? " , and then allow the user to
input the 2 answers. for example : 80 4
but it doesn't ask that question, it just answers without asking! any
help... ? this is from the Beginner Programming with Java for Dummies
- 2nd Edition. I typed it straight out of the book, and checked it
vary carefully. the output im currently gettins is... "Each kid gets 6
gumballs"
import java.util.Scanner;
class KeepingMoreKidsQuiet {
public static void main(String args[]) {
Scanner myScanner = new Scanner(System.in);
int gumballs;
int kids;
int gumballsPerKid;
System.out.print("How many gumballs? How many kids? ");
gumballs = myScanner.nextInt();
kids = myScanner.nextInt();
gumballsPerKid = gumballs / kids;
System.out.print("Each kid gets ");
System.out.print(gumballsPerKid);
System.out.println(" gumballs.");
}
}