Why is my Java program not working correctly? -
this code working class. when run it hangs @ welcome message , go no further, wont let me type anything. i've asked instructor multiple times , giving advice corrections given still dont fix issue have. doing wrong?
/* * file: foreverygame.java * author: darren pirtle * date: november 8, 2016 * purpose: provide amount of money customer can win per * nba game if betting x amount of money x amount of games */ // import statements import java.util.scanner; public class foreverygame { public static void main(string[] args) { //declare variables int numbergames = 0; int moneyamount = 0; //display welcome message system.out.println(" "); system.out.println("how money can win?!"); system.out.println(" "); //scanner class scanner scannerin = new scanner(system.in); //prompt user number of games during night while (numbergames > 15 || numbergames <= 0); { system.out.println("enter number of games being played tonight"); numbergames = scannerin.nextint(); if (numbergames > 15) system.out.println("please re-enter number less 16"); if (numbergames <= 0) system.out.println("you cannot play 0 or less tha 0 games"); } system.out.println(" "); //display results system.out.println("there many games being played tonight: " + numbergames); system.out.println(" "); //prompt user how wants bet on every game system.out.println("how money willing bet on " + numbergames + " games?"); moneyamount = scannerin.nextint(); // display results system.out.println("you willing bet $" + moneyamount + " on " + numbergames + " games."); system.out.println(" "); // while loop // declare variables int count = 1; while (count <= numbergames) { int multiplyint = (count * moneyamount); system.out.println("you can win: " + moneyamount + " x " + count + " = $" + multiplyint); // increment counter count++; } } }
while (numbergames > 15 || numbergames <= 0);
no semicolon
Comments
Post a Comment