Last active
September 15, 2016 21:18
-
-
Save dhust/fc40657512bc3d188b206af303a5de32 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void main(String[] args) { | |
// Variables | |
Scanner in = new Scanner(System.in); | |
int shapeLength; | |
String shape; | |
// Get length and shape from the user | |
System.out.print("Enter the length of the shape: "); | |
shapeLength = in.nextInt(); | |
System.out.print("Enter the name of the shape: "); | |
shape = in.nextLine(); | |
/* If BOTH "shapeLength < 100" AND | |
* "shape.equalsIgnoreCase("square")" are TRUE | |
* then the body of that code will run | |
*/ | |
if (shapeLength < 100 && shape.equalsIgnoreCase("square")) { | |
System.out.println("That square is small."); | |
} | |
else if (shapeLength >= 100 && shape.equalsIgnoreCase("square")){ | |
System.out.println("That square is large."); | |
} | |
else { | |
System.out.println("I only like squares."); | |
} | |
// Close the scanner | |
in.close(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment