Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import javafx.scene.paint.Stop;
- import java.text.SimpleDateFormat;
- import java.util.ArrayList;
- import java.util.Date;
- import java.util.Scanner;
- import java.util.Random;
- import java.util.concurrent.TimeUnit;
- import java.awt.Graphics;
- class Colors {
- public static final String RESET = "\u001B[0m";
- public static final String BLACK = "\u001B[30m";
- public static final String RED = "\u001B[31m";
- public static final String GREEN = "\u001B[32m";
- public static final String YELLOW = "\u001B[33m";
- public static final String BLUE = "\u001B[34m";
- public static final String PURPLE = "\u001B[35m";
- public static final String CYAN = "\u001B[36m";
- public static final String WHITE = "\u001B[37m";
- }
- public class Main {
- public static void input() {
- Scanner reader = new Scanner(System.in);
- System.out.print(Colors.GREEN + "> " + Colors.RESET);
- String input = reader.nextLine();
- if (input.equals("hello") || input.equals("HELLO")) {
- System.out.println("Hello World!");
- input();
- }
- if (input.equals("help")) {
- System.out.println(Colors.RED + "Commands:" + Colors.RESET);
- System.out.println(Colors.RED + "hello - outputs Hello World" + Colors.RESET);
- System.out.println(Colors.RED + "help - you're already here" + Colors.RESET);
- System.out.println(Colors.RED + "shutdown - shuts the console down" + Colors.RESET);
- System.out.println(Colors.RED + "exit - shuts the console down" + Colors.RESET);
- System.out.println(Colors.RED + "run - runs a program" + Colors.RESET);
- System.out.println(Colors.RED + "run help - displays all programs you can run" + Colors.RESET);
- System.out.println(Colors.RED + "back - takes you back to the main menu" + Colors.RESET);
- System.out.println(Colors.RED + "time - says your current time and date" + Colors.RESET);
- System.out.println(Colors.RED + "flip - flips a coin" + Colors.RESET);
- input();
- }
- if (input.equals("shutdown") || input.equals("exit")) {
- System.exit(0);
- }
- if (input.equals("run help")) {
- System.out.println(Colors.RED + "Programs:" + Colors.RESET);
- System.out.println(Colors.RED + "scalculator - shape calculator, defines area, circumference, and similar items" + Colors.RESET);
- System.out.println(Colors.RED + "calculator - simple calculator" + Colors.RESET);
- input();
- }
- if (input.equals("run calculator")) {
- normalCalculator();
- }
- if (input.equals("run scalculator")) {
- KuebjiiCalculatorMenu();
- }
- if (input.equals("back"))
- {
- mainMenu();
- }
- if (input.equals("time"))
- {
- SimpleDateFormat formatter= new SimpleDateFormat("yyyy-MM-dd 'at' HH:mm:ss z");
- Date date = new Date(System.currentTimeMillis());
- System.out.println(formatter.format(date));
- input();
- }
- if (input.equals("flip"))
- {
- if (Math.random() < 0.5){
- System.out.println("Heads");
- }else{
- System.out.println("Tails");
- }
- }
- if (input.equals("clear"))
- {
- System.out.println();System.out.println();System.out.println();System.out.println();System.out.println();System.out.println();System.out.println();System.out.println();System.out.println();
- System.out.println();System.out.println();System.out.println();System.out.println();System.out.println();System.out.println();System.out.println();System.out.println();System.out.println();
- System.out.println();System.out.println();System.out.println();System.out.println();System.out.println();System.out.println();System.out.println();System.out.println();System.out.println();
- input();
- }
- else
- {
- System.out.println("Command: " + input + " was not found!");
- mainMenu();
- }
- }
- public static void mainMenu() {
- Scanner reader = new Scanner(System.in);
- System.out.println(Colors.RED + "Kuebjii's Console" + Colors.RESET);
- System.out.println(Colors.RED + "Please enter your comamand below" + Colors.RESET);
- System.out.println();
- input();
- }
- public static void main(String[] args) throws InterruptedException {
- Scanner reader = new Scanner(System.in);
- System.out.print(Colors.GREEN + "> " + Colors.RESET);
- String input = reader.findInLine("start");
- if (input.equals("start")) {
- System.out.println(Colors.GREEN + "Booting Console" + Colors.RESET);
- Thread.sleep(500);
- System.out.println(Colors.GREEN + "Console Loaded" + Colors.RESET);
- Thread.sleep(500);
- System.out.println(Colors.GREEN + "Showing Console Now!" + Colors.RESET);
- Thread.sleep(50);
- mainMenu();
- } else {
- System.out.println("System.Start Error: Entered unknown command");
- }
- }
- /// ######################################################################## SHAPE CALCULATOR ######## DO NOT TOUCH ########################################################
- public static void KuebjiiCalculatorMenu() {
- Scanner reader = new Scanner(System.in);
- System.out.println("Welcome to Kuebjii's Calculator");
- System.out.println("Circle");
- System.out.println("Square");
- System.out.println("Rectangle");
- System.out.println("Please type out the number you would like to use");
- String input = reader.nextLine();
- if (input.equals("circle")) {
- circles();
- }
- if (input.equals("square")) {
- squares();
- }
- if (input.equals("rectangle")) {
- rectangle();
- }
- if (input.equals("devmode")) {
- devMode();
- }
- if (input.equals("back")) {
- mainMenu();
- }
- }
- public static void rectangle() {
- Scanner reader = new Scanner(System.in);
- System.out.println("Please enter the length of the rectangle");
- double length = reader.nextDouble();
- System.out.println("Please enter the width of the rectangle");
- double width = reader.nextDouble();
- double perimeter = 2 * (length * width);
- double area = length * width;
- System.out.println("Here is the perimeter of the rectangle: " + perimeter);
- System.out.println("Here is the area of the rectangle: " + area);
- System.out.println();
- KuebjiiCalculatorMenu();
- }
- public static void squares() {
- Scanner reader = new Scanner(System.in);
- System.out.println("Please enter one side of the square");
- double side = reader.nextDouble();
- double perimeter;
- double area;
- perimeter = side + side + side + side;
- area = side * side;
- System.out.println("Here is the perimeter of the square: " + perimeter);
- System.out.println("Here is the area of the square: " + area);
- System.out.println();
- KuebjiiCalculatorMenu();
- }
- public static void circles() {
- System.out.println("What is the radius of the circle?");
- Scanner reader = new Scanner(System.in);
- double radius = reader.nextDouble();
- double circumference;
- double area;
- circumference = 2 * 3.14 * radius;
- area = 3.14 * radius * radius;
- System.out.println("Here is the circumference of the circle" + circumference);
- System.out.println("Here is the area of the circle" + area);
- System.out.println();
- KuebjiiCalculatorMenu();
- }
- public static void devMode() {
- Scanner reader = new Scanner(System.in);
- System.out.println("D E V C O N S O L E");
- System.out.println("1. Circle");
- System.out.println("2. Square");
- System.out.println("3. Rectangle");
- System.out.println("4. Testing Cycle");
- int selector = reader.nextInt();
- if (selector == 1) {
- System.out.println("What is the radius of the circle?");
- double radius = reader.nextDouble();
- double circumference;
- double area;
- circumference = 2 * 3.14 * radius;
- area = 3.14 * radius * radius;
- System.out.println("Radius = " + radius + " Equation for circumference: 2 * 3.14 * " + radius);
- System.out.println("Radius = " + radius + " Equation for area: 3.14 * " + radius + " * " + radius);
- System.out.println("Here is the circumference of the circle: " + circumference);
- System.out.println("Here is the area of the circle: " + area);
- }
- }
- public static void normalCalculator() {
- Scanner reader = new Scanner(System.in);
- System.out.println(Colors.RED + "Welcome to the normal calculator" + Colors.RESET);
- System.out.println(Colors.RED + "Type any equation into the line below" + Colors.RESET);
- System.out.println(Colors.BLUE + "Do you want to add, subtract, mutliply, or divide");
- System.out.print(Colors.GREEN + "> " + Colors.RESET);
- String input = reader.nextLine();
- if (input.equals("add")) {
- System.out.println(Colors.BLUE + "Now type the first number you want to add");
- double input1 = reader.nextDouble();
- System.out.println(Colors.BLUE + "Now type the second number you wan to add");
- double input2 = reader.nextDouble();
- double inputTotal = input1 + input2;
- System.out.println("Your number is: " + inputTotal);
- normalCalculator();
- }
- if (input.equals("subtract")) {
- System.out.println(Colors.BLUE + "Now type the first number you want to subtract");
- double input1 = reader.nextDouble();
- System.out.println(Colors.BLUE + "Now type the second number you wan to subtract");
- double input2 = reader.nextDouble();
- double inputTotal = input1 - input2;
- System.out.println("Your number is: " + inputTotal);
- normalCalculator();
- }
- if (input.equals("multiply")) {
- System.out.println(Colors.BLUE + "Now type the first number you want to multiply");
- double input1 = reader.nextDouble();
- System.out.println(Colors.BLUE + "Now type the second number you wan to multiply");
- double input2 = reader.nextDouble();
- double inputTotal = input1 * input2;
- System.out.println("Your number is: " + inputTotal);
- normalCalculator();
- }
- if (input.equals("divide")) {
- System.out.println(Colors.BLUE + "Now type the first number you want to divide");
- double input1 = reader.nextDouble();
- System.out.println(Colors.BLUE + "Now type the second number you wan to divide");
- double input2 = reader.nextDouble();
- double inputTotal = input1 / input2;
- System.out.println("Your number is: " + inputTotal);
- normalCalculator();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement