Advertisement
Kuebjii

Kuebjii's Calculator V1

Dec 13th, 2019
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 6.37 KB | None | 0 0
  1.  
  2. import java.util.ArrayList;
  3. import java.util.Scanner;
  4. import java.util.Random;
  5. import java.util.concurrent.TimeUnit;
  6. import java.awt.Graphics;
  7.  
  8. class ANSIConstants {
  9.     public static final String ANSI_RESET = "\u001B[0m";
  10.     public static final String ANSI_BLACK = "\u001B[30m";
  11.     public static final String ANSI_RED = "\u001B[31m";
  12.     public static final String ANSI_GREEN = "\u001B[32m";
  13.     public static final String ANSI_YELLOW = "\u001B[33m";
  14.     public static final String ANSI_BLUE = "\u001B[34m";
  15.     public static final String ANSI_PURPLE = "\u001B[35m";
  16.     public static final String ANSI_CYAN = "\u001B[36m";
  17.     public static final String ANSI_WHITE = "\u001B[37m";
  18. }
  19. public class Main {
  20.  
  21.     public static void circles ()
  22.     {
  23.         System.out.println("What is the radius of the circle?");
  24.         Scanner reader = new Scanner (System.in);
  25.         double radius = reader.nextDouble();
  26.         double circumference;
  27.         double area;
  28.         circumference = 2 * 3.14 * radius;
  29.         area = 3.14 * radius * radius;
  30.         System.out.println("Here is the circumference of the circle" + circumference);
  31.         System.out.println("Here is the area of the circle" + area);
  32.         System.out.println();
  33.         System.out.println("Continue back to the menu?");
  34.         String nothing = reader.nextLine();
  35.         if (nothing == ""){
  36.             KuebjiiCalculatorMenu();
  37.         }
  38.         KuebjiiCalculatorMenu();
  39.  
  40.     }
  41.  
  42.     public static void squares ()
  43.     {
  44.         Scanner reader = new Scanner(System.in);
  45.         System.out.println("Please enter one side of the square");
  46.         double side = reader.nextDouble();
  47.         double perimeter;
  48.         double area;
  49.  
  50.         perimeter = side + side + side + side;
  51.         area = side * side;
  52.  
  53.         System.out.println("Here is the perimeter of the square: " + perimeter);
  54.         System.out.println("Here is the area of the square: " + area);
  55.         System.out.println();
  56.         System.out.println("Continue back to the menu?");
  57.         String nothing = reader.nextLine();
  58.         if (nothing == ""){
  59.             KuebjiiCalculatorMenu();
  60.         }
  61.         KuebjiiCalculatorMenu();
  62.     }
  63.     public static void rectangle ()
  64.     {
  65.         Scanner reader = new Scanner (System.in);
  66.         System.out.println("Please enter the length of the rectangle");
  67.         double length = reader.nextDouble();
  68.         System.out.println("Please enter the width of the rectangle");
  69.         double width = reader.nextDouble();
  70.  
  71.         double perimeter = 2 * (length * width);
  72.         double area = length * width;
  73.  
  74.         System.out.println("Here is the perimeter of the rectangle: " + perimeter);
  75.         System.out.println("Here is the area of the rectangle: " + area);
  76.         System.out.println();
  77.         System.out.println("Continue back to the menu?");
  78.         String nothing = reader.nextLine();
  79.         if (nothing == ""){
  80.             KuebjiiCalculatorMenu();
  81.         }
  82.         else
  83.         {
  84.             KuebjiiCalculatorMenu();
  85.         }
  86.     }
  87.  
  88.     public static void KuebjiiCalculatorMenu()
  89.     {
  90.         Scanner reader = new Scanner(System.in);
  91.         System.out.println("Welcome to Kuebjii's Calculator");
  92.         System.out.println("1. Circle");
  93.         System.out.println("2. Square");
  94.         System.out.println("3. Rectangle");
  95.         System.out.println("Please type out the number you would like to use");
  96.         int selector = reader.nextInt();
  97.         if (selector == 1){
  98.             circles();
  99.         }
  100.         if (selector == 2){
  101.             squares();
  102.         }
  103.         if (selector == 3)
  104.         {
  105.             rectangle();
  106.         }
  107.         if (selector == 4)
  108.         {
  109.             devMode();
  110.         }
  111.     }
  112.  
  113.     public static void main(String[] args) throws InterruptedException {
  114.         System.out.println(ANSIConstants.ANSI_RED + "Checking for first construction" + ANSIConstants.ANSI_RESET);
  115.         Thread.sleep(1000);
  116.         System.out.println(ANSIConstants.ANSI_GREEN + "DONE" + ANSIConstants.ANSI_RESET);
  117.         System.out.println(ANSIConstants.ANSI_RED + "Checking for Second construction" + ANSIConstants.ANSI_RESET);
  118.         Thread.sleep(4000);
  119.         System.out.println(ANSIConstants.ANSI_GREEN + "DONE" + ANSIConstants.ANSI_RESET);
  120.         Thread.sleep(5000);
  121.         System.out.print(ANSIConstants.ANSI_CYAN + "Loading." + ANSIConstants.ANSI_RESET);
  122.         System.out.print(ANSIConstants.ANSI_CYAN + "." + ANSIConstants.ANSI_RESET);Thread.sleep(1000);System.out.print(ANSIConstants.ANSI_CYAN + "." + ANSIConstants.ANSI_RESET);Thread.sleep(1000);System.out.print(ANSIConstants.ANSI_CYAN + "." + ANSIConstants.ANSI_RESET);Thread.sleep(1000);System.out.print(ANSIConstants.ANSI_CYAN + "." + ANSIConstants.ANSI_RESET);Thread.sleep(1000);
  123.         Thread.sleep(1000);System.out.print(ANSIConstants.ANSI_CYAN + "." + ANSIConstants.ANSI_RESET);Thread.sleep(1000);System.out.print(ANSIConstants.ANSI_CYAN + "." + ANSIConstants.ANSI_RESET);Thread.sleep(1000);System.out.print(ANSIConstants.ANSI_CYAN + "." + ANSIConstants.ANSI_RESET);
  124.         System.out.println();
  125.         System.out.println();
  126.         KuebjiiCalculatorMenu();
  127.     }
  128.     public static void devMode ()
  129.     {
  130.         Scanner reader = new Scanner(System.in);
  131.         System.out.println("D E V   C O N S O L E");
  132.         System.out.println("1. Circle");
  133.         System.out.println("2. Square");
  134.         System.out.println("3. Rectangle");
  135.         System.out.println("4. Testing Cycle");
  136.         int selector = reader.nextInt();
  137.         if (selector == 1){
  138.             System.out.println("What is the radius of the circle?");
  139.             double radius = reader.nextDouble();
  140.             double circumference;
  141.             double area;
  142.             circumference = 2 * 3.14 * radius;
  143.             area = 3.14 * radius * radius;
  144.             System.out.println("Radius = " + radius + " Equation for circumference: 2 * 3.14 * " + radius);
  145.             System.out.println("Radius = " + radius + " Equation for area: 3.14 * " + radius + " * " + radius);
  146.             System.out.println("Here is the circumference of the circle: " + circumference);
  147.             System.out.println("Here is the area of the circle: " + area);
  148.         }
  149.         if (selector == 4)
  150.         {
  151.             System.out.println(ANSIConstants.ANSI_CYAN + "testing the cyan color" + ANSIConstants.ANSI_RESET);
  152.         }
  153.  
  154.         }
  155.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement