/** * Created by Roy on 1/5/2016. */ import java.util.Scanner; public class Project { public static void main(String []args){ Scanner UI = new Scanner(System.in); System.out.println("What would you like to do?"); System.out.println("1. Sinos Sentence"); System.out.println("2. Calculator"); System.out.println("3. Quadratic Formula"); System.out.println("4. Circle stuff"); System.out.println("5. Pythagoras"); System.out.println("6. Tag Functions"); char choice = UI.next().charAt(0); switch(choice){ case '1': System.out.println("Insert first Edge if known"); double edgeOne = UI.nextDouble(); System.out.println("Insert second Edge if known"); double edgeTwo = UI.nextDouble(); System.out.println("Insert third Edge if known"); double edgeThree = UI.nextDouble(); System.out.println("Insert first Angle if known"); double angleOne = UI.nextDouble(); System.out.println("Insert second Angle if known"); double angleTwo = UI.nextDouble(); System.out.println("Insert third Angle if known"); double angleThree = UI.nextDouble(); double angleOneSin = Math.abs(Math.sin(angleOne)); double angleTwoSin = Math.abs(Math.sin(angleTwo)); double angleThreeSin = Math.abs(Math.sin(angleThree)); System.out.print("Edge1 / sin" + angleOne ); System.out.print(" = "); System.out.println(edgeOne + " / " + angleOneSin); System.out.println(); System.out.print("Edge2 / sin" + angleTwo ); System.out.print(" = "); System.out.println(edgeTwo + " / " + angleTwoSin); System.out.println(); System.out.print("Edge3 / sin" + angleThree ); System.out.print(" = "); System.out.println(edgeThree + " / " + angleThreeSin); break; case '2': double Ans = 0; System.out.println("Insert first number"); double num1 = UI.nextDouble(); System.out.println("Will you need a second number?"); boolean SecNum = UI.nextBoolean(); double num2 = 0; if(SecNum == true){ System.out.println("Insert second number"); num2 = UI.nextDouble(); } else{ } System.out.println("Which operation would you like to execute?"); System.out.println("+, -, *, /, ^, S"); choice = UI.next().charAt(0); switch(choice){ case '+': Ans = Plus(num1, num2); break; case '-': Ans = Minus(num1, num2); break; case '*': Ans = Multiply(num1, num2); break; case '/': Ans = Divide(num1, num2); break; case '^': Ans = Power(num1, num2); break; case 'S': Ans = SquareRoot(num1); break; default: System.out.println("Incorrect. Try Again!"); break; } System.out.println("The answer for " + num1 + " " + choice + " " + num2 + " = " + Ans); break; case '3': double x1 = 0; double x2 = 0; System.out.println("Insert a"); double a = UI.nextDouble(); System.out.println("Insert b"); double b = UI.nextDouble(); System.out.println("Insert c"); double c = UI.nextDouble(); if(((Power(b, 2) -4*a*c)/2*a) <= 0){ System.out.println("The discriminant is negative"); } else{ x1 = -b - (SquareRoot((Power(b, 2) -4*a*c)/2*a)); System.out.println("X1 = " + x1); x2 = -b + (SquareRoot((Power(b, 2) -4*a*c)/2*a)); System.out.println("X2 = " + x2); } break; case '4': System.out.println("Do you have Diameter or Radius?"); System.out.println("D for Diameter or R for Radius"); double Diameter = 0; double Radius = 0; double Hekef = 0; double Area = 0; choice = UI.next().charAt(0); switch(choice){ case 'D': System.out.println("Insert Diameter"); Diameter = UI.nextDouble(); Radius = Diameter/2; Hekef = Hekef(Diameter); Area = Area(Radius); break; case 'R': System.out.println("Insert Radius"); Radius = UI.nextDouble(); Diameter = Radius * 2; Hekef = Hekef(Diameter); Area = Area(Radius); default: System.out.println("Incorrect. Try Again!"); break; } System.out.println("Hekef = " + Hekef + "Area " + Area); break; case '5': System.out.println("Which are you missing A, B or C?"); choice = UI.next().charAt(0); a = 0; b = 0; c = 0; Ans = 0; switch(choice) { case 'A': System.out.println("Insert B"); b = UI.nextDouble(); System.out.println("Insert C"); c = UI.nextDouble(); Ans = Power(c, 2) - Power(b, 2); Ans = SquareRoot(Ans); break; case 'B': System.out.println("Insert A"); a = UI.nextDouble(); System.out.println("Insert C"); c = UI.nextDouble(); Ans = Power(c, 2) - Power(a, 2); Ans = SquareRoot(Ans); break; case 'C': System.out.println("Insert A"); a = UI.nextDouble(); System.out.println("Insert B"); b = UI.nextDouble(); Ans = Power(a, 2) + Power(b, 2); Ans = SquareRoot(Ans); break; default: System.out.println("Incorrect. Try Again!"); break; } System.out.println(choice + " = " + Ans); break; case '6': a = 0; int aPow = 0; b = 0; int bPow = 0; c = 0; int cPow = 0; double cutA = 0; double cutB = 0; double cutC = 0; System.out.println("Insert A"); a = UI.nextDouble(); System.out.println("Insert Power of A"); aPow = UI.nextInt(); System.out.println("Insert B"); b = UI.nextDouble(); System.out.println("Insert Power of B"); bPow = UI.nextInt(); System.out.println("Insert C"); c = UI.nextDouble(); System.out.println("Insert Power of C"); cPow = UI.nextInt(); cutA = aPow * a; aPow = aPow - 1; cutB = bPow * b; bPow = bPow - 1; cutC = cPow * c; cPow = cPow - 1; System.out.println("The tag is " + cutA + "a^" + aPow + " " + cutB + "b^" + bPow + " " + cutC + "c^" + cPow); break; default: System.out.println("Incorrect. Try Again!"); break; } } public static double Plus(double a, double b){ return a+b; } public static double Minus(double a, double b){ return a-b; } public static double Multiply(double a, double b){ return a*b; } public static double Divide(double a, double b){ return a/b; } public static double Power(double a, double b){ return Math.pow(a,b); } public static double SquareRoot(double a){ return Math.sqrt(a); } public static double Hekef(double D){ return D * Math.PI; } public static double Area(double R){ return Power(R, 2) * Math.PI; } }