Created
October 28, 2016 13:50
-
-
Save jshawl/127cf26be3fe2357342110df9b49dd60 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
import java.util.Scanner; | |
public class OnTheMoney { | |
public static void main(String[] args) { | |
String n; | |
String lastName; | |
int denom; | |
//"denom" will be the variable used for either the $1, $10, or $100 | |
Scanner sc = new Scanner (System.in); | |
String name1 = "Washington"; | |
String name2 = "Hamilton"; | |
String name3 = "Franklin"; | |
int denom1 = 1; | |
int denom2 = 10; | |
int denom3 = 100; | |
System.out.print ( "Type 1 to enter a denomination, 2 to enter a " + | |
"last name:") ; | |
int stepOne = sc.nextInt(); | |
if (stepOne == (1) ) { | |
System.out.print ("Choose a Denomination:"); | |
int enterDenom = sc.nextInt(); | |
if (enterDenom == (1)) { | |
System.out.println ("Which person appears on the " | |
+enterDenom+ " dollar bill?"); | |
n = sc.next(); | |
if (n.equals(name1)){ | |
System.out.println ("Correct!"); | |
} | |
if (n.equals(name3) || n.equals(name2)){ | |
System.out.println("Incorrect!"); | |
} | |
else System.out.println("Invalid choice!"); | |
} | |
else if (enterDenom == (10)) { | |
System.out.println ("Which person appears on the " | |
+enterDenom+ " dollar bill?"); | |
n = sc.next(); | |
if (n.equals(name2)){ | |
System.out.println ("Correct!"); | |
} | |
if (n.equals(name1) || n.equals(name3)){ | |
System.out.println("Incorrect!"); | |
} | |
else System.out.println("Invalid choice!"); | |
} | |
else if (enterDenom == (100)) { | |
System.out.println ("Which person appears on " + | |
"the " | |
+enterDenom+ " dollar bill?"); | |
n = sc.next(); | |
if (n.equals(name3)){ | |
System.out.println ("Correct!"); | |
} | |
if (n.equals(name1) || n.equals(name2)){ | |
System.out.println("Incorrect!"); | |
} | |
else System.out.println("Invalid choice!"); | |
} | |
} | |
else if (stepOne == (2) ) {{ | |
System.out.println ("Choose a name:"); | |
lastName = sc.next(); | |
{ | |
if (lastName.equals(name1)) { | |
System.out.println("Which denomination does " | |
+lastName+ " appear on?"); | |
denom = sc.nextInt(); | |
if (denom == denom1) { | |
System.out.println ("Correct!"); | |
} | |
else System.out.println ("Incorrect!"); | |
} | |
else if (lastName.equals(name2)) { | |
System.out.println("Which denomination does " | |
+lastName+ " appear on?"); | |
denom = sc.nextInt(); | |
if (denom == denom2) { | |
System.out.println ("Correct!"); | |
} | |
else System.out.println ("Incorrect!"); | |
} | |
else if (lastName.equals(name3)) { | |
System.out.println("Which denomination does " | |
+lastName+ " appear on?"); | |
denom = sc.nextInt(); | |
if (denom == denom3) { | |
System.out.println ("Correct!"); | |
} | |
else System.out.println ("Incorrect!"); | |
} | |
else System.out.println("Invalid choice!"); | |
} | |
}} | |
else System.out.println("Invalid Menu Option"); | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment