darkuslord98

Main Hub Class

Apr 7th, 2013
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 6.42 KB | None | 0 0
  1. import java.util.Scanner;
  2. // A hub class! This contains all of my previous works, including the never-before-seen Interior Angle Calculator!
  3. public class HubClass {
  4.     public static void main(String[] args) {
  5.         Scanner keyboard = new Scanner(System.in);
  6.         int programNumber;
  7.         System.out.println("Welcome. This is the hub for all of the programs written by Matthew Weidenhamer. ");
  8.         System.out.println("To begin, please enter in a number corresponding to the program.");
  9.         System.out.println("Press 1 for M&M calculator, press 2 for Lunch Predictamatron, and 3 for Interior angles calculator.");
  10.         programNumber = keyboard.nextInt();
  11.         System.out.println("Thank you. Loading the program...");
  12.         if(programNumber == 1){
  13.             int  numRed, numBlue, numOrange, numGreen, numBrown, numYellow, totalPrevious, previousBags, previousAdd, finalAdd, finalSubtract;
  14.            
  15.             System.out.println("Welcome, one and all, to the great M&M's calculator!");
  16.             System.out.println("Please Enter the total number of bags opened beforehand.");
  17.             previousBags = keyboard.nextInt();
  18.             System.out.print("So thats ");
  19.             System.out.print(previousBags);
  20.             System.out.println(" Bags beforehand? Ok, onto the next part.");
  21.            
  22.             System.out.println("How many M&Ms were in the bags? This should be COMBINED, not an average.");
  23.             totalPrevious = keyboard.nextInt();
  24.             System.out.println("Got it! So, there were " + totalPrevious + " M&M's in the previous bags? Ok then! next!");
  25.            
  26.             System.out.println("How many RED M&Ms were there? Again, this should be the total combined, not the average.");
  27.             numRed = keyboard.nextInt();
  28.             System.out.println("How man BLUE M&Ms were there?");
  29.             numBlue = keyboard.nextInt();
  30.             System.out.println("How many ORANGE M&Ms were there?");
  31.             numOrange = keyboard.nextInt();
  32.             System.out.println("How many GREEN M&Ms were there?");
  33.             numGreen = keyboard.nextInt();
  34.             System.out.println("How many BROWN M&Ms were there?");
  35.             numBrown = keyboard.nextInt();
  36.             System.out.println("Last one! How many YELLOW M&M's were there?");
  37.             numYellow = keyboard.nextInt();
  38.             System.out.println("Thank you for the inputs. Beginning processing...");
  39.             numRed = (numRed / previousBags) - 2;
  40.             numBlue = (numBlue / previousBags) - 2;
  41.             numOrange = (numOrange / previousBags) - 2;
  42.             numGreen = (numGreen / previousBags) - 2;
  43.             numBrown = (numBrown / previousBags) - 2;
  44.             numYellow = (numYellow / previousBags) - 2;
  45.             finalAdd = numYellow + numBrown + numGreen + numOrange + numBlue + numRed;
  46.             finalSubtract = (totalPrevious / previousBags) - finalAdd;
  47.             finalAdd = finalAdd + finalSubtract;
  48.             System.out.println("OK! Calculations complete!");
  49.             System.out.print("This machine estimates that there are ");
  50.             System.out.print(numRed);
  51.             System.out.print(" Red, ");
  52.             System.out.print(numBlue);
  53.             System.out.print(" Blue, ");
  54.             System.out.print(numOrange);
  55.             System.out.print(" Orange, ");
  56.             System.out.print(numGreen);
  57.             System.out.print(" Green, ");
  58.             System.out.print(numBrown);
  59.             System.out.print(" Brown, and ");
  60.             System.out.print(numYellow);
  61.             System.out.println(" Yellows.");
  62.             System.out.print("There are also ");
  63.             System.out.print(finalSubtract);
  64.             System.out.println(" Unknown. These are the ones that I cannot calculate precisely.");
  65.             System.out.print("All in all, there are ");
  66.             System.out.print(finalAdd);
  67.             System.out.println(" M&Ms total.");
  68.             System.out.println("Thank you for using the M&M Predictatron.");
  69.         }
  70.         if(programNumber == 2){
  71.             int last, dayOfWeek;
  72.             System.out.println("Welcome to the lunch predictamatron.");
  73.             System.out.println("To begin, what day of the week do you want to find out? Monday = 1, Tuesday = 2, Etc.");
  74.             dayOfWeek = keyboard.nextInt();
  75.             System.out.println("How many weeks ago from the estimated date did they last serve Macaroni and Cheese? Put 0 for this week.");
  76.             last = keyboard.nextInt();
  77.             System.out.println("Calculating... ");
  78.             if(last == 3){
  79.                 System.out.println("They are serving Macaroni and Cheese.");
  80.             }
  81.             if(last == 0 && dayOfWeek == 2){
  82.                 System.out.println("They are serving Pork Barbeque.");
  83.             }
  84.             if(last == 0 && dayOfWeek == 3){
  85.                 System.out.println("They are serving Taco Pie.");
  86.             }
  87.             if(last == 0 && dayOfWeek == 4){
  88.                 System.out.println("They are serving Spaghetti.");
  89.             }
  90.             if(last == 0 && dayOfWeek == 5){
  91.                 System.out.println("They are serving Chicken Enchiladas.");
  92.             }
  93.             if(last == 1 && dayOfWeek == 1){
  94.                 System.out.println("They are serving Lasagna.");
  95.             }
  96.             if(last == 1 && dayOfWeek == 2){
  97.                 System.out.println("They are serving Turkey.");
  98.             }
  99.             if(last == 1 && dayOfWeek == 3){
  100.                 System.out.println("They are serving Tacos.");
  101.             }
  102.             if(last == 1 && dayOfWeek == 4){
  103.                 System.out.println("They are serving Chicken Parmesian.");
  104.             }
  105.             if(last == 1 && dayOfWeek == 5){
  106.                 System.out.println("They are serving Nachos.");
  107.             }
  108.             if(last == 2 && dayOfWeek == 1){
  109.                 System.out.println("They are serving Teriyaki/Orange Chicken.");
  110.             }
  111.             if(last == 2 && dayOfWeek == 2){
  112.                 System.out.println("They are serving Mozzareilla Sticks.");
  113.             }
  114.             if(last == 2 && dayOfWeek == 3){
  115.                 System.out.println("They are serving Chicken Fajita Rice Bowl.");
  116.             }
  117.             if(last == 2 && dayOfWeek == 4){
  118.                 System.out.println("They are serving Cheese Ravioli.");
  119.             }
  120.             if(last == 2 && dayOfWeek == 5){
  121.                 System.out.println("They are serving Hotdogs/Corn dogs.");
  122.             }
  123.             System.out.println("Thank you for using the lunch predictamatron. Code by Matthew Weidenhamer. If nothing popped up before this, assume you derped.");
  124.         }
  125.         if(programNumber == 3){
  126.             System.out.println("Welcome to the Interior angle calculator.");
  127.             System.out.println("Please input the number of sides of the convex polygon."); // what it prints when it boots up.
  128.  
  129.             int inputNumber = keyboard.nextInt();// the keyboard input getter thingy
  130.             inputNumber--;
  131.             inputNumber--; // subtracts two
  132.            
  133.             if (inputNumber > 0) // if the number input was 3 or greater when it was input.....
  134.             {
  135.                 inputNumber = inputNumber * 180;
  136.                 System.out.print("The sum of the Interior Angles is ");
  137.                 System.out.print(inputNumber);
  138.                 System.out.println(" Degrees.Thank you for using use Interior Angle calculator. Code by Matthew Weidenhamer"); // it outputs the angle sum.
  139.             }
  140.             else // otherwise...
  141.             {
  142.                 System.out.println("False. This is not a polygon."); // it prints that this is not  polygon.
  143.             }
  144.         }
  145.     }
  146.  
  147. }
Advertisement
Add Comment
Please, Sign In to add comment