Advertisement
Guest User

Untitled

a guest
Jun 23rd, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.86 KB | None | 0 0
  1.  
  2. public class daylight {
  3.    
  4.     private String trim;
  5.     private double trimmed;  
  6.     private double theta;
  7.     private int trimBackInt;
  8.     private double i;
  9.     private double tans;
  10.     private double answer;
  11.    
  12.     public void trim(String thetaString, double iThing) {
  13.         trim = thetaString;
  14.         i = iThing;
  15.         String trimBack = trim;
  16.         trimBack = trimBack.substring(0, trim.indexOf(','));
  17.         trimBackInt = Integer.parseInt(trimBack);
  18.         trim = trim.substring(trim.indexOf(',') + 1, trim.lastIndexOf('\''));
  19.         trimmed = Integer.parseInt(trim);
  20.         trimmed /= 60;
  21.         theta = trimBackInt + trimmed;
  22.         System.out.printf("theta: %.3f\n", theta);
  23.         System.out.printf("i: %.3f\n", i);
  24.         i = i * (Math.PI / 180);
  25.         theta = theta * (Math.PI / 180);
  26.         tans = Math.tan(i) * Math.tan(theta);
  27.         answer = 24 * (1-((Math.acos(tans))/Math.PI));
  28.         System.out.printf("Answer: %.3f", answer);
  29.     }
  30.  
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement