Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.ArrayList;
- import java.util.Scanner;
- import java.util.Random;
- import java.util.concurrent.TimeUnit;
- import java.awt.Graphics;
- class ANSIConstants {
- public static final String ANSI_RESET = "\u001B[0m";
- public static final String ANSI_BLACK = "\u001B[30m";
- public static final String ANSI_RED = "\u001B[31m";
- public static final String ANSI_GREEN = "\u001B[32m";
- public static final String ANSI_YELLOW = "\u001B[33m";
- public static final String ANSI_BLUE = "\u001B[34m";
- public static final String ANSI_PURPLE = "\u001B[35m";
- public static final String ANSI_CYAN = "\u001B[36m";
- public static final String ANSI_WHITE = "\u001B[37m";
- }
- public class Main {
- 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();
- System.out.println("Continue back to the menu?");
- String nothing = reader.nextLine();
- if (nothing == ""){
- KuebjiiCalculatorMenu();
- }
- 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();
- System.out.println("Continue back to the menu?");
- String nothing = reader.nextLine();
- if (nothing == ""){
- KuebjiiCalculatorMenu();
- }
- KuebjiiCalculatorMenu();
- }
- 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();
- System.out.println("Continue back to the menu?");
- String nothing = reader.nextLine();
- if (nothing == ""){
- KuebjiiCalculatorMenu();
- }
- else
- {
- KuebjiiCalculatorMenu();
- }
- }
- public static void KuebjiiCalculatorMenu()
- {
- Scanner reader = new Scanner(System.in);
- System.out.println("Welcome to Kuebjii's Calculator");
- System.out.println("1. Circle");
- System.out.println("2. Square");
- System.out.println("3. Rectangle");
- System.out.println("Please type out the number you would like to use");
- int selector = reader.nextInt();
- if (selector == 1){
- circles();
- }
- if (selector == 2){
- squares();
- }
- if (selector == 3)
- {
- rectangle();
- }
- if (selector == 4)
- {
- devMode();
- }
- }
- public static void main(String[] args) throws InterruptedException {
- System.out.println(ANSIConstants.ANSI_RED + "Checking for first construction" + ANSIConstants.ANSI_RESET);
- Thread.sleep(1000);
- System.out.println(ANSIConstants.ANSI_GREEN + "DONE" + ANSIConstants.ANSI_RESET);
- System.out.println(ANSIConstants.ANSI_RED + "Checking for Second construction" + ANSIConstants.ANSI_RESET);
- Thread.sleep(4000);
- System.out.println(ANSIConstants.ANSI_GREEN + "DONE" + ANSIConstants.ANSI_RESET);
- Thread.sleep(5000);
- System.out.print(ANSIConstants.ANSI_CYAN + "Loading." + ANSIConstants.ANSI_RESET);
- 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);
- 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);
- System.out.println();
- 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);
- }
- if (selector == 4)
- {
- System.out.println(ANSIConstants.ANSI_CYAN + "testing the cyan color" + ANSIConstants.ANSI_RESET);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement