Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package TortugasNinja;
- import java.io.BufferedReader;
- import java.io.InputStreamReader;
- import java.util.Scanner;
- public class TortugasNinja {
- public static void main(String[] args) {
- int numbadguys=0;
- int numinnocent=0;
- double leonardo1=0;
- double michelangelo1=0;
- double donatello1=0;
- double raphael1=0;
- boolean donatrue=false;
- boolean michatrue=false;
- boolean raphtrue=false;
- boolean leotrue=false;
- Scanner scan = new Scanner(System.in);
- int var;
- boolean quit = false;
- while(!quit){
- System.out.println("Please Make a selection:");
- System.out.println("[1] Show badguys");
- System.out.println("[2] Show innocents");
- System.out.println("[3] Realization");
- System.out.println("[4] Show innocents");
- System.out.println("[5] Balance");
- System.out.println("[6] Show innocents");
- System.out.println("[7] Show innocents");
- System.out.println("[8] exit");
- System.out.println("Selection: ");
- var = scan.nextInt();
- switch (var){
- case 1:
- boolean dummy = true;
- Scanner badguys = new Scanner(System.in);
- int malos;
- do
- {
- System.out.println("Input the amount of bad guys caught today.");
- malos = badguys.nextInt();
- if(malos > 0)
- break;
- else
- System.out.println("Error: Input a non-negative amount of bad guys.");
- } while (dummy == true);
- System.out.println("There are " + malos + " bad guys caught.");
- numbadguys=malos;
- break;
- case 2:
- System.out.println("Innocents saved");
- boolean dummy1 = true;
- Scanner innocent = new Scanner(System.in);
- int innocentes;
- do
- {
- System.out.println("Input the amount of bad guys caught today.");
- innocentes = innocent.nextInt();
- if(innocentes > 0)
- break;
- else
- System.out.println("Error: Input a non-negative amount of innocents.");
- } while (dummy1 == true);
- System.out.println("There are " + innocentes + " innocents saved.");
- numinnocent=innocentes;
- break;
- case 3:
- Scanner tortuga = new Scanner(System.in);
- System.out.println("Turtle name?");
- String turtle = tortuga.nextLine();
- System.out.println(turtle);
- if (turtle.toUpperCase().equals("DONATELLO") && donatrue == false){
- System.out.println(turtle);
- while( tortuga.hasNextDouble()){
- System.out.println("Realizacion");
- double dona = tortuga.nextDouble();
- if (dona < 10 && dona > 0){
- donatello1=dona;
- donatrue = true;
- System.out.println("Done!");
- break;
- } else {
- System.out.println("Try again.");
- }
- }
- }else {
- System.out.println("Already done!");
- }
- break;
- case 5:
- if(numbadguys>numinnocent){
- System.out.println("Negative");
- }
- else if(numbadguys - numinnocent == 0){
- System.out.println("Neutral");
- }
- else{
- System.out.println("Positive!");
- }
- break;
- case 8:
- quit = true;
- break;
- }
- }
- scan.close();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement