fork download
  1. /*
  2. CSC110 Assignment:_Lab04.java__
  3. Programmer: Phillip Sherman
  4. Due Date: 2/13/12
  5. Points: 35
  6.  
  7. Description of Application: Four methods (harmonic, sum, triangle, parellelogram)
  8.  
  9. Description of Inputs: Class constants N, SIZE, HEIGHT
  10.  
  11. Description of Outputs: '*', ' ', or intergers
  12. */
  13.  
  14.  
  15. class Lab04 {
  16.  
  17. //Class constants required for modifying output of various methods
  18. public static final int N = 100;
  19. public static final int SIZE = 1;
  20. public static final int HEIGHT = 1;
  21.  
  22.  
  23. public static void main (String[] args) {
  24.  
  25. harmonic();
  26.  
  27. }
  28.  
  29. //Method for printing sum of harmonic series
  30. public static void harmonic () {
  31.  
  32. double sum=0;
  33. for (int i=1; i<=N; i++) {
  34.  
  35. sum += 1.0/i;
  36.  
  37. }
  38. System.out.println(sum);
  39. //method for printing a triangle of spaces & * using SIZE constant to
  40. //format the output size
  41. }
  42.  
  43. //method for printing sum [Rules : Odd Integers up to N; sum of first N positive odd integers]
  44. public static void sum () {
  45.  
  46.  
  47. }
  48.  
  49. //method for printing a triangle of spaces & * using SIZE constant to
  50. //format the output size
  51. public static void triangle () {
  52.  
  53.  
  54. }
  55.  
  56. //method for printing a parallelogram of spaces & * using SIZE constant to
  57. //format the output size
  58. public static void parallelogram () {
  59.  
  60.  
  61. }
  62.  
  63. }
Success #stdin #stdout 0.08s 212416KB
stdin
Standard input is empty
stdout
5.187377517639621