Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package magazin;
- import java.io.File;
- import java.io.FileNotFoundException;
- import java.util.Scanner;
- import java.util.StringTokenizer;
- public class MainApp {
- public static void main(String[] args) {
- String s;
- try
- {
- Scanner scanner=new Scanner(new File("in.txt"));
- while(scanner.hasNextLine())
- {
- StringTokenizer st = new StringTokenizer(scanner.nextLine(),";");
- while (st.hasMoreTokens())
- {
- System.out.println(st.nextToken());
- }
- }
- }
- catch (FileNotFoundException e)
- {
- e.printStackTrace();
- }
- }
- }
- package parabola;
- public class Parabola {
- double a,b,c;
- double x, y;
- public Parabola(double a, double b, double c){
- this.a=a;
- this.b=b;
- this.c=c;
- }
- public Parabola(Parabola p) {
- a=p.a;
- b=p.b;
- c=p.c;
- }
- public void Afisare()
- {
- System.out.println("f(x) = "+a+" x^2 + "+b+" x + "+c);
- }
- public void Varf()
- {
- x=-b/(2*a);
- y=(-(b*b)+4*a*c)/(4*a);
- System.out.println("x = "+x+" y = "+y);
- }
- public static void Mijloc(Parabola d, Parabola e)
- {
- double m1, m2;
- d.Varf();
- e.Varf();
- m1=(d.x+e.x)/2;
- m2=(d.y+e.y)/2;
- System.out.println(m1);
- System.out.println(m2);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement