Advertisement
Kuebjii

Kuebjii's Console V1

Dec 15th, 2019
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 10.30 KB | None | 0 0
  1. import javafx.scene.paint.Stop;
  2. import java.text.SimpleDateFormat;
  3. import java.util.ArrayList;
  4. import java.util.Date;
  5. import java.util.Scanner;
  6. import java.util.Random;
  7. import java.util.concurrent.TimeUnit;
  8. import java.awt.Graphics;
  9.  
  10. class Colors {
  11.     public static final String RESET = "\u001B[0m";
  12.     public static final String BLACK = "\u001B[30m";
  13.     public static final String RED = "\u001B[31m";
  14.     public static final String GREEN = "\u001B[32m";
  15.     public static final String YELLOW = "\u001B[33m";
  16.     public static final String BLUE = "\u001B[34m";
  17.     public static final String PURPLE = "\u001B[35m";
  18.     public static final String CYAN = "\u001B[36m";
  19.     public static final String WHITE = "\u001B[37m";
  20. }
  21.  
  22. public class Main {
  23.  
  24.     public static void input() {
  25.         Scanner reader = new Scanner(System.in);
  26.         System.out.print(Colors.GREEN + "> " + Colors.RESET);
  27.         String input = reader.nextLine();
  28.  
  29.         if (input.equals("hello") || input.equals("HELLO")) {
  30.             System.out.println("Hello World!");
  31.             input();
  32.         }
  33.         if (input.equals("help")) {
  34.             System.out.println(Colors.RED + "Commands:" + Colors.RESET);
  35.             System.out.println(Colors.RED + "hello - outputs Hello World" + Colors.RESET);
  36.             System.out.println(Colors.RED + "help - you're already here" + Colors.RESET);
  37.             System.out.println(Colors.RED + "shutdown - shuts the console down" + Colors.RESET);
  38.             System.out.println(Colors.RED + "exit - shuts the console down" + Colors.RESET);
  39.             System.out.println(Colors.RED + "run - runs a program" + Colors.RESET);
  40.             System.out.println(Colors.RED + "run help - displays all programs you can run" + Colors.RESET);
  41.             System.out.println(Colors.RED + "back - takes you back to the main menu" + Colors.RESET);
  42.             System.out.println(Colors.RED + "time - says your current time and date" + Colors.RESET);
  43.             input();
  44.         }
  45.         if (input.equals("shutdown") || input.equals("exit")) {
  46.             System.exit(0);
  47.         }
  48.         if (input.equals("run help")) {
  49.             System.out.println(Colors.RED + "Programs:" + Colors.RESET);
  50.             System.out.println(Colors.RED + "scalculator - shape calculator, defines area, circumference, and similar items" + Colors.RESET);
  51.             System.out.println(Colors.RED + "calculator - simple calculator" + Colors.RESET);
  52.             input();
  53.         }
  54.  
  55.         if (input.equals("run calculator")) {
  56.             normalCalculator();
  57.         }
  58.  
  59.         if (input.equals("run scalculator")) {
  60.             KuebjiiCalculatorMenu();
  61.         }
  62.  
  63.         if (input.equals("back"))
  64.         {
  65.             mainMenu();
  66.         }
  67.  
  68.         if (input.equals("time"))
  69.         {
  70.             SimpleDateFormat formatter= new SimpleDateFormat("yyyy-MM-dd 'at' HH:mm:ss z");
  71.             Date date = new Date(System.currentTimeMillis());
  72.             System.out.println(formatter.format(date));
  73.             input();
  74.         }
  75.         else
  76.         {
  77.             mainMenu();
  78.         }
  79.     }
  80.  
  81.     public static void mainMenu() {
  82.         Scanner reader = new Scanner(System.in);
  83.         System.out.println(Colors.RED + "Kuebjii's Console" + Colors.RESET);
  84.         System.out.println(Colors.RED + "Please enter your comamand below" + Colors.RESET);
  85.         System.out.println();
  86.         input();
  87.     }
  88.  
  89.     public static void main(String[] args) throws InterruptedException {
  90.         Scanner reader = new Scanner(System.in);
  91.         System.out.print(Colors.GREEN + "> " + Colors.RESET);
  92.         String input = reader.findInLine("start");
  93.  
  94.         if (input.equals("start")) {
  95.             System.out.println(Colors.GREEN + "Booting Console" + Colors.RESET);
  96.             Thread.sleep(500);
  97.             System.out.println(Colors.GREEN + "Console Loaded" + Colors.RESET);
  98.             Thread.sleep(500);
  99.             System.out.println(Colors.GREEN + "Showing Console Now!" + Colors.RESET);
  100.             Thread.sleep(50);
  101.             mainMenu();
  102.         } else {
  103.             System.out.println("System.Start Error: Entered unknown command");
  104.         }
  105.     }
  106.  
  107.     /// ######################################################################## SHAPE CALCULATOR ######## DO NOT TOUCH ########################################################
  108.     public static void KuebjiiCalculatorMenu() {
  109.         Scanner reader = new Scanner(System.in);
  110.         System.out.println("Welcome to Kuebjii's Calculator");
  111.         System.out.println("Circle");
  112.         System.out.println("Square");
  113.         System.out.println("Rectangle");
  114.         System.out.println("Please type out the number you would like to use");
  115.         String input = reader.nextLine();
  116.         if (input.equals("circle")) {
  117.             circles();
  118.         }
  119.         if (input.equals("square")) {
  120.             squares();
  121.         }
  122.         if (input.equals("rectangle")) {
  123.             rectangle();
  124.         }
  125.         if (input.equals("devmode")) {
  126.             devMode();
  127.         }
  128.         if (input.equals("back")) {
  129.             mainMenu();
  130.         }
  131.     }
  132.  
  133.     public static void rectangle() {
  134.         Scanner reader = new Scanner(System.in);
  135.         System.out.println("Please enter the length of the rectangle");
  136.         double length = reader.nextDouble();
  137.         System.out.println("Please enter the width of the rectangle");
  138.         double width = reader.nextDouble();
  139.  
  140.         double perimeter = 2 * (length * width);
  141.         double area = length * width;
  142.  
  143.         System.out.println("Here is the perimeter of the rectangle: " + perimeter);
  144.         System.out.println("Here is the area of the rectangle: " + area);
  145.         System.out.println();
  146.         KuebjiiCalculatorMenu();
  147.  
  148.     }
  149.  
  150.     public static void squares() {
  151.         Scanner reader = new Scanner(System.in);
  152.         System.out.println("Please enter one side of the square");
  153.         double side = reader.nextDouble();
  154.         double perimeter;
  155.         double area;
  156.  
  157.         perimeter = side + side + side + side;
  158.         area = side * side;
  159.  
  160.         System.out.println("Here is the perimeter of the square: " + perimeter);
  161.         System.out.println("Here is the area of the square: " + area);
  162.         System.out.println();
  163.         KuebjiiCalculatorMenu();
  164.  
  165.     }
  166.  
  167.     public static void circles() {
  168.         System.out.println("What is the radius of the circle?");
  169.         Scanner reader = new Scanner(System.in);
  170.         double radius = reader.nextDouble();
  171.         double circumference;
  172.         double area;
  173.         circumference = 2 * 3.14 * radius;
  174.         area = 3.14 * radius * radius;
  175.         System.out.println("Here is the circumference of the circle" + circumference);
  176.         System.out.println("Here is the area of the circle" + area);
  177.         System.out.println();
  178.         KuebjiiCalculatorMenu();
  179.     }
  180.  
  181.     public static void devMode() {
  182.         Scanner reader = new Scanner(System.in);
  183.         System.out.println("D E V   C O N S O L E");
  184.         System.out.println("1. Circle");
  185.         System.out.println("2. Square");
  186.         System.out.println("3. Rectangle");
  187.         System.out.println("4. Testing Cycle");
  188.         int selector = reader.nextInt();
  189.         if (selector == 1) {
  190.             System.out.println("What is the radius of the circle?");
  191.             double radius = reader.nextDouble();
  192.             double circumference;
  193.             double area;
  194.             circumference = 2 * 3.14 * radius;
  195.             area = 3.14 * radius * radius;
  196.             System.out.println("Radius = " + radius + " Equation for circumference: 2 * 3.14 * " + radius);
  197.             System.out.println("Radius = " + radius + " Equation for area: 3.14 * " + radius + " * " + radius);
  198.             System.out.println("Here is the circumference of the circle: " + circumference);
  199.             System.out.println("Here is the area of the circle: " + area);
  200.         }
  201.     }
  202.  
  203.     public static void normalCalculator() {
  204.         Scanner reader = new Scanner(System.in);
  205.  
  206.         System.out.println(Colors.RED + "Welcome to the normal calculator" + Colors.RESET);
  207.         System.out.println(Colors.RED + "Type any equation into the line below" + Colors.RESET);
  208.         System.out.println(Colors.BLUE + "Do you want to add, subtract, mutliply, or divide");
  209.  
  210.         System.out.print(Colors.GREEN + "> " + Colors.RESET);
  211.         String input = reader.nextLine();
  212.  
  213.         if (input.equals("add")) {
  214.             System.out.println(Colors.BLUE + "Now type the first number you want to add");
  215.             double input1 = reader.nextDouble();
  216.  
  217.             System.out.println(Colors.BLUE + "Now type the second number you wan to add");
  218.             double input2 = reader.nextDouble();
  219.  
  220.             double inputTotal = input1 + input2;
  221.  
  222.             System.out.println("Your number is: " + inputTotal);
  223.             normalCalculator();
  224.         }
  225.         if (input.equals("subtract")) {
  226.             System.out.println(Colors.BLUE + "Now type the first number you want to subtract");
  227.             double input1 = reader.nextDouble();
  228.  
  229.             System.out.println(Colors.BLUE + "Now type the second number you wan to subtract");
  230.             double input2 = reader.nextDouble();
  231.  
  232.             double inputTotal = input1 - input2;
  233.  
  234.             System.out.println("Your number is: " + inputTotal);
  235.             normalCalculator();
  236.         }
  237.         if (input.equals("multiply")) {
  238.             System.out.println(Colors.BLUE + "Now type the first number you want to multiply");
  239.             double input1 = reader.nextDouble();
  240.  
  241.             System.out.println(Colors.BLUE + "Now type the second number you wan to multiply");
  242.             double input2 = reader.nextDouble();
  243.  
  244.             double inputTotal = input1 * input2;
  245.  
  246.             System.out.println("Your number is: " + inputTotal);
  247.             normalCalculator();
  248.         }
  249.         if (input.equals("divide")) {
  250.             System.out.println(Colors.BLUE + "Now type the first number you want to divide");
  251.             double input1 = reader.nextDouble();
  252.  
  253.             System.out.println(Colors.BLUE + "Now type the second number you wan to divide");
  254.             double input2 = reader.nextDouble();
  255.  
  256.             double inputTotal = input1 / input2;
  257.  
  258.             System.out.println("Your number is: " + inputTotal);
  259.             normalCalculator();
  260.         }
  261.     }
  262. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement