Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- // A hub class! This contains all of my previous works, including the never-before-seen Interior Angle Calculator!
- public class HubClass {
- public static void main(String[] args) {
- Scanner keyboard = new Scanner(System.in);
- int programNumber;
- System.out.println("Welcome. This is the hub for all of the programs written by Matthew Weidenhamer. ");
- System.out.println("To begin, please enter in a number corresponding to the program.");
- System.out.println("Press 1 for M&M calculator, press 2 for Lunch Predictamatron, and 3 for Interior angles calculator.");
- programNumber = keyboard.nextInt();
- System.out.println("Thank you. Loading the program...");
- if(programNumber == 1){
- int numRed, numBlue, numOrange, numGreen, numBrown, numYellow, totalPrevious, previousBags, previousAdd, finalAdd, finalSubtract;
- System.out.println("Welcome, one and all, to the great M&M's calculator!");
- System.out.println("Please Enter the total number of bags opened beforehand.");
- previousBags = keyboard.nextInt();
- System.out.print("So thats ");
- System.out.print(previousBags);
- System.out.println(" Bags beforehand? Ok, onto the next part.");
- System.out.println("How many M&Ms were in the bags? This should be COMBINED, not an average.");
- totalPrevious = keyboard.nextInt();
- System.out.println("Got it! So, there were " + totalPrevious + " M&M's in the previous bags? Ok then! next!");
- System.out.println("How many RED M&Ms were there? Again, this should be the total combined, not the average.");
- numRed = keyboard.nextInt();
- System.out.println("How man BLUE M&Ms were there?");
- numBlue = keyboard.nextInt();
- System.out.println("How many ORANGE M&Ms were there?");
- numOrange = keyboard.nextInt();
- System.out.println("How many GREEN M&Ms were there?");
- numGreen = keyboard.nextInt();
- System.out.println("How many BROWN M&Ms were there?");
- numBrown = keyboard.nextInt();
- System.out.println("Last one! How many YELLOW M&M's were there?");
- numYellow = keyboard.nextInt();
- System.out.println("Thank you for the inputs. Beginning processing...");
- numRed = (numRed / previousBags) - 2;
- numBlue = (numBlue / previousBags) - 2;
- numOrange = (numOrange / previousBags) - 2;
- numGreen = (numGreen / previousBags) - 2;
- numBrown = (numBrown / previousBags) - 2;
- numYellow = (numYellow / previousBags) - 2;
- finalAdd = numYellow + numBrown + numGreen + numOrange + numBlue + numRed;
- finalSubtract = (totalPrevious / previousBags) - finalAdd;
- finalAdd = finalAdd + finalSubtract;
- System.out.println("OK! Calculations complete!");
- System.out.print("This machine estimates that there are ");
- System.out.print(numRed);
- System.out.print(" Red, ");
- System.out.print(numBlue);
- System.out.print(" Blue, ");
- System.out.print(numOrange);
- System.out.print(" Orange, ");
- System.out.print(numGreen);
- System.out.print(" Green, ");
- System.out.print(numBrown);
- System.out.print(" Brown, and ");
- System.out.print(numYellow);
- System.out.println(" Yellows.");
- System.out.print("There are also ");
- System.out.print(finalSubtract);
- System.out.println(" Unknown. These are the ones that I cannot calculate precisely.");
- System.out.print("All in all, there are ");
- System.out.print(finalAdd);
- System.out.println(" M&Ms total.");
- System.out.println("Thank you for using the M&M Predictatron.");
- }
- if(programNumber == 2){
- int last, dayOfWeek;
- System.out.println("Welcome to the lunch predictamatron.");
- System.out.println("To begin, what day of the week do you want to find out? Monday = 1, Tuesday = 2, Etc.");
- dayOfWeek = keyboard.nextInt();
- System.out.println("How many weeks ago from the estimated date did they last serve Macaroni and Cheese? Put 0 for this week.");
- last = keyboard.nextInt();
- System.out.println("Calculating... ");
- if(last == 3){
- System.out.println("They are serving Macaroni and Cheese.");
- }
- if(last == 0 && dayOfWeek == 2){
- System.out.println("They are serving Pork Barbeque.");
- }
- if(last == 0 && dayOfWeek == 3){
- System.out.println("They are serving Taco Pie.");
- }
- if(last == 0 && dayOfWeek == 4){
- System.out.println("They are serving Spaghetti.");
- }
- if(last == 0 && dayOfWeek == 5){
- System.out.println("They are serving Chicken Enchiladas.");
- }
- if(last == 1 && dayOfWeek == 1){
- System.out.println("They are serving Lasagna.");
- }
- if(last == 1 && dayOfWeek == 2){
- System.out.println("They are serving Turkey.");
- }
- if(last == 1 && dayOfWeek == 3){
- System.out.println("They are serving Tacos.");
- }
- if(last == 1 && dayOfWeek == 4){
- System.out.println("They are serving Chicken Parmesian.");
- }
- if(last == 1 && dayOfWeek == 5){
- System.out.println("They are serving Nachos.");
- }
- if(last == 2 && dayOfWeek == 1){
- System.out.println("They are serving Teriyaki/Orange Chicken.");
- }
- if(last == 2 && dayOfWeek == 2){
- System.out.println("They are serving Mozzareilla Sticks.");
- }
- if(last == 2 && dayOfWeek == 3){
- System.out.println("They are serving Chicken Fajita Rice Bowl.");
- }
- if(last == 2 && dayOfWeek == 4){
- System.out.println("They are serving Cheese Ravioli.");
- }
- if(last == 2 && dayOfWeek == 5){
- System.out.println("They are serving Hotdogs/Corn dogs.");
- }
- System.out.println("Thank you for using the lunch predictamatron. Code by Matthew Weidenhamer. If nothing popped up before this, assume you derped.");
- }
- if(programNumber == 3){
- System.out.println("Welcome to the Interior angle calculator.");
- System.out.println("Please input the number of sides of the convex polygon."); // what it prints when it boots up.
- int inputNumber = keyboard.nextInt();// the keyboard input getter thingy
- inputNumber--;
- inputNumber--; // subtracts two
- if (inputNumber > 0) // if the number input was 3 or greater when it was input.....
- {
- inputNumber = inputNumber * 180;
- System.out.print("The sum of the Interior Angles is ");
- System.out.print(inputNumber);
- System.out.println(" Degrees.Thank you for using use Interior Angle calculator. Code by Matthew Weidenhamer"); // it outputs the angle sum.
- }
- else // otherwise...
- {
- System.out.println("False. This is not a polygon."); // it prints that this is not polygon.
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment