fork download
  1. // import java.util.Scanner;
  2.  
  3. public abstract class Funktion {
  4.  
  5. /**
  6. * @param args
  7. */
  8. double xmin, xmax, abstand;
  9. public abstract double f(double x);
  10. public abstract double g(double x);
  11. public void tabelle () {
  12.  
  13. for (double x = xmin; x <= xmax; x = x + abstand) {
  14. System.out.println("f(" + java.lang.Math.round( x * 100 ) / 100. + ") = " + f(x));
  15. }
  16. }
  17.  
  18. public void newton (double s) { }
  19. }
  20.  
  21. class Parabel extends Funktion {
  22.  
  23. int a, b, c;
  24. double xmin, xmax, abstand;
  25.  
  26. public double f(double x) {
  27. //return x*x*a+b*x+c;
  28. return x*x*x*a + b*x*x + c*x + 30;
  29. }
  30.  
  31. public double g(double x) {
  32. return 2*a*x+b;
  33. }
  34.  
  35. Parabel(double xmin,double xmax,double abstand, int a, int b, int c) {
  36. // Funktion.xmin = this.xmin;
  37. this.xmin = xmin;
  38. this.xmax = xmax;
  39. this.abstand = abstand;
  40. this.a = a;
  41. this.b = b;
  42. this.c = c;
  43. /*Funktion.xmin = this.xmin;
  44. Funktion.xmax = this.xmax;
  45. Funktion.abstand = this.abstand;*/
  46. }
  47.  
  48. public static void main(String[] args) {
  49.  
  50. Parabel para = new Parabel(1.0,2.0,0.1,2,-20,-6);
  51. para.tabelle();
  52.  
  53. }
  54. }
  55.  
  56.  
  57.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:3: error: class Funktion is public, should be declared in a file named Funktion.java
public abstract class Funktion {
                ^
1 error
stdout
Standard output is empty