Advertisement
leonard007

Untitled

Oct 5th, 2022
170
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.24 KB | None | 0 0
  1. package magazin;
  2.  
  3. import java.io.File;
  4. import java.io.FileNotFoundException;
  5. import java.util.Scanner;
  6. import java.util.StringTokenizer;
  7.  
  8. public class MainApp {
  9.  
  10. public static void main(String[] args) {
  11. String s;
  12. try
  13. {
  14. Scanner scanner=new Scanner(new File("in.txt"));
  15. while(scanner.hasNextLine())
  16. {
  17. StringTokenizer st = new StringTokenizer(scanner.nextLine(),";");
  18. while (st.hasMoreTokens())
  19. {
  20. System.out.println(st.nextToken());
  21. }
  22. }
  23. }
  24. catch (FileNotFoundException e)
  25. {
  26. e.printStackTrace();
  27. }
  28.  
  29.  
  30. }
  31.  
  32. }
  33.  
  34. package parabola;
  35.  
  36. public class Parabola {
  37. double a,b,c;
  38. double x, y;
  39. public Parabola(double a, double b, double c){
  40. this.a=a;
  41. this.b=b;
  42. this.c=c;
  43. }
  44.  
  45. public Parabola(Parabola p) {
  46. a=p.a;
  47. b=p.b;
  48. c=p.c;
  49. }
  50.  
  51. public void Afisare()
  52. {
  53. System.out.println("f(x) = "+a+" x^2 + "+b+" x + "+c);
  54. }
  55.  
  56. public void Varf()
  57. {
  58. x=-b/(2*a);
  59. y=(-(b*b)+4*a*c)/(4*a);
  60. System.out.println("x = "+x+" y = "+y);
  61. }
  62.  
  63. public static void Mijloc(Parabola d, Parabola e)
  64. {
  65. double m1, m2;
  66. d.Varf();
  67. e.Varf();
  68. m1=(d.x+e.x)/2;
  69. m2=(d.y+e.y)/2;
  70. System.out.println(m1);
  71. System.out.println(m2);
  72. }
  73.  
  74. }
  75.  
  76.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement