Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class daylight {
- private String trim;
- private double trimmed;
- private double theta;
- private int trimBackInt;
- private double i;
- private double tans;
- private double answer;
- public void trim(String thetaString, double iThing) {
- trim = thetaString;
- i = iThing;
- String trimBack = trim;
- trimBack = trimBack.substring(0, trim.indexOf(','));
- trimBackInt = Integer.parseInt(trimBack);
- trim = trim.substring(trim.indexOf(',') + 1, trim.lastIndexOf('\''));
- trimmed = Integer.parseInt(trim);
- trimmed /= 60;
- theta = trimBackInt + trimmed;
- System.out.printf("theta: %.3f\n", theta);
- System.out.printf("i: %.3f\n", i);
- i = i * (Math.PI / 180);
- theta = theta * (Math.PI / 180);
- tans = Math.tan(i) * Math.tan(theta);
- answer = 24 * (1-((Math.acos(tans))/Math.PI));
- System.out.printf("Answer: %.3f", answer);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement