|
@@ -33,8 +33,6 @@ public class Operations
|
33
|
33
|
|
34
|
34
|
Scanner input = new Scanner(System.in);
|
35
|
35
|
Double result = 0.0;
|
36
|
|
- double firstNumber = 0.0;
|
37
|
|
- double SecondNumber =0.0;
|
38
|
36
|
//String userInput = scanner.nextLine();
|
39
|
37
|
scienticFunctions ScientificFunctions = new scienticFunctions();
|
40
|
38
|
// Calculator calc = new ....
|
|
@@ -46,49 +44,30 @@ public class Operations
|
46
|
44
|
break;
|
47
|
45
|
}
|
48
|
46
|
if (command.equalsIgnoreCase("sine")) {
|
49
|
|
- // read first number
|
50
|
|
- System.out.print("Enter a number: ");
|
51
|
|
- firstNumber = input.nextDouble();
|
52
|
|
- // read second number
|
53
|
|
- //double secondNumber = input.nextDouble();
|
54
|
|
- // call the add method on calc and display
|
55
|
|
- result = ScientificFunctions.sine(firstNumber);
|
56
|
|
- //firstNumber = result;
|
57
|
|
- //result = firstNumber;
|
|
47
|
+ result = ScientificFunctions.sine(Console.getDoubleInput("Enter number"));
|
58
|
48
|
Console.printResult(result);
|
59
|
49
|
}
|
60
|
50
|
if (command.equalsIgnoreCase("cos")) {
|
61
|
|
- // read first number
|
62
|
|
- firstNumber = input.nextDouble();
|
63
|
|
- // call the cosine method on calc and display
|
64
|
|
- result = ScientificFunctions.cos(firstNumber);
|
|
51
|
+ result = ScientificFunctions.cosine(Console.getDoubleInput("Enter number"));
|
65
|
52
|
Console.printResult(result);
|
66
|
53
|
}
|
67
|
54
|
if (command.equalsIgnoreCase("tan")) {
|
68
|
|
- // call the square method on calc and display
|
69
|
|
- firstNumber = input.nextDouble();
|
70
|
|
- result = ScientificFunctions.tangent(firstNumber);
|
|
55
|
+ result = ScientificFunctions.tangent(Console.getDoubleInput("Enter number"));
|
71
|
56
|
Console.printResult(result);
|
72
|
57
|
}
|
73
|
58
|
if (command.equalsIgnoreCase("cos-1")) {
|
74
|
|
- // call the square method on calc and display
|
75
|
|
- firstNumber = input.nextDouble();
|
76
|
|
- result = ScientificFunctions.inverseCosine(firstNumber);
|
|
59
|
+ result = ScientificFunctions.inverseCosine(Console.getDoubleInput("Enter number"));
|
77
|
60
|
Console.printResult(result);
|
78
|
61
|
}
|
79
|
62
|
if (command.equalsIgnoreCase("sin-1")) {
|
80
|
|
- // call the square method on calc and display
|
81
|
|
- firstNumber = input.nextDouble();
|
82
|
|
- result = ScientificFunctions.inverseSine(firstNumber);
|
|
63
|
+ result = ScientificFunctions.inverseSine(Console.getDoubleInput("Enter number"));
|
83
|
64
|
Console.printResult(result);
|
84
|
65
|
}
|
85
|
66
|
if (command.equalsIgnoreCase("tan-1")) {
|
86
|
|
- // call the square method on calc and display
|
87
|
|
- firstNumber = input.nextDouble();
|
88
|
|
- result = ScientificFunctions.inverseTangent(firstNumber);
|
|
67
|
+ result = ScientificFunctions.inverseTangent(Console.getDoubleInput("Enter number"));
|
89
|
68
|
Console.printResult(result);
|
90
|
69
|
}
|
91
|
|
- firstNumber = result;
|
|
70
|
+ //firstNumber = result;
|
92
|
71
|
// and on and on
|
93
|
72
|
}
|
94
|
73
|
|