Advertisement
Guest User

Untitled

a guest
Oct 24th, 2014
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.94 KB | None | 0 0
  1. /**
  2.  * Created by vasco on 24/10/2014.
  3.  */
  4. public class Golf {
  5.  
  6.     private double amplitude = 1, frequentie = 1;
  7.  
  8.     public double getYwaarde(double x){
  9.         double y;
  10.         y = amplitude * Math.sinh(frequentie*x);
  11.         return y;
  12.     }
  13.  
  14.     public String toString(){
  15.         String output = String.format("y = %f sin( %f x )", amplitude, frequentie);
  16.         if (this.amplitude == 1) {
  17.             output = String.format("y = sin(%.1f x)", frequentie);
  18.         }
  19.         else if (this.frequentie == 1){
  20.             output = String.format("y = %.1f sin(x)", amplitude);
  21.         }
  22.         else {
  23.             output = String.format("y = %.1f sin( %.1f x )", amplitude, frequentie);
  24.         }
  25.         return output;
  26.       }
  27.  
  28.     public void setAmplitude(double amplitude) {
  29.         this.amplitude = amplitude;
  30.     }
  31.  
  32.     public void setFrequentie(double frequentie) {
  33.         this.frequentie = frequentie;
  34.     }
  35.  
  36.  
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement