-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCalculator.java
More file actions
69 lines (41 loc) · 1.35 KB
/
Copy pathCalculator.java
File metadata and controls
69 lines (41 loc) · 1.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
import java.util.ArrayList;
import java.util.Scanner;
public class Calculator {
public static void main(String[] args)
{
ArrayList<Integer> bob = new ArrayList<Integer>();
for(int i = 0; i < 40; i++)
{
bob.add((int)Math.pow(2, i));
}
Function joe = new Function(bob);
joe.printPyramid();
joe.findExpression();
joe.printExpression();
double ourGuess = joe.sumExpression(80);
double theGuess = Math.pow(2, 80);
double errorPerc = ((theGuess - ourGuess)/theGuess) * 100;
System.out.println("OUR GUESS IS:");
System.out.println(ourGuess);
System.out.println("THE REAL ONE IS:");
System.out.println(theGuess);
System.out.println("THE ERROR PERCENT IS:");
System.out.println(errorPerc + "%");
/**
* Scanner ask = new Scanner(System.in);
System.out.println("Enter a list of values, with a comma to space them out(end with a comma as well)");
String userImp = ask.nextLine();
ArrayList<Integer> imput = new ArrayList<Integer>();
for(int i = 0; i < userImp.length();)
{
String val = userImp.substring(i, userImp.indexOf(",", i));
imput.add(Integer.parseInt(val));
i = userImp.indexOf(",", i) + 1;
}
Function test = new Function(imput);
test.printPyramid();
test.findExpression();
test.printExpression();
*/
}
}