DarrenPJr DarrenPJr - 1 month ago 8
Java Question

Why is my Java program not working correctly?

This is the code I am working for my class. When I run it it hangs at the welcome message and will go no further, it wont even let me type anything. I've asked my instructor multiple times and he is giving good advice but the corrections that I am given still dont fix the issue I have. What am I doing wrong?

/*
* File: ForEveryGame.java
* Author: Darren Pirtle
* Date: November 8, 2016
* Purpose: Provide the amount of money a customer can win per
* NBA game if they are betting X amount of money for 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 A Welcome Message
System.out.println(" ");
System.out.println("How much money can you win?!");
System.out.println(" ");
//Scanner class
Scanner scannerIn = new Scanner(System.in);
//Prompt the user for the number of games during the night
while (numberGames > 15 || numberGames <= 0); {
System.out.println("Enter the number of games being played tonight");
numberGames = scannerIn.nextInt();
if (numberGames > 15)
System.out.println("Please re-enter a number less than 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 are this many games being played tonight: " + numberGames);
System.out.println(" ");
//Prompt the user for how much he wants to bet on every game
System.out.println("How much money are you willing to bet on " + numberGames + " games?");
moneyAmount = scannerIn.nextInt();
// Display results
System.out.println("You are willing to 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++;
}
}
}


Error

Answer
while (numberGames > 15 || numberGames <= 0);

no semicolon