Skip to content

Instantly share code, notes, and snippets.

@MarGul
Created October 7, 2016 20:04
Show Gist options
  • Save MarGul/a45b7abf502acac5bbdf108f3557c9fc to your computer and use it in GitHub Desktop.
Save MarGul/a45b7abf502acac5bbdf108f3557c9fc to your computer and use it in GitHub Desktop.
import java.util.Scanner;
public class Lab4 {
public static void main(String[] args){
Scanner input = new Scanner(System.in);
System.out.println("Would you like to see an X or O?");
String shape = input.next();
Integer size;
while (!shape.equals("x")) {
if(shape.equals("o")) {
break;
}
System.out.println("Invalid, try again");
shape = input.next();
}
System.out.println("Enter the size");
size = input.nextInt();
if(shape.equals("x")) {
System.out.println("Print an X with size: " + size);
}
if(shape.equals("o")) {
System.out.println("Print an O with size: " + size);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment