Professional Documents
Culture Documents
CSC Aggisment #5
CSC Aggisment #5
CSC Aggisment #5
Lab Assignment # 07
Name - Manpreet Singh
Student ID -0164720
Submission Date - 15-03-2023
Input:
import java.util.Scanner;
import java.util.Random;
int coins = 0;
do {
System.out.println("Insert a coin by typing 'C' and pressing Enter, or press any other key to
quit.");
if (userInput.equals("C")) {
coins += 4;
coins += 2;
} else {
} else {
playAgain = false;
if (playAgain) {
System.out.println("You now have " + coins + " coins. Would you like to play again? (Y/N)");
if (!playAgainInput.equalsIgnoreCase("Y")) {
playAgain = false;
} while (playAgain);
System.out.println("Thank you for playing the slot machine game! You won a total of " + coins + "
coins.");
}
CSC 109- Spring 2023
College of New Caledonia
OUTPUT :
Insert a coin by typing 'C' and pressing Enter, or press any other key to quit.
Thank you for playing the slot machine game! You won a total of 0 coins.