Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.company;
- public class Funkcja {
- private double a,b,c;
- public Funkcja(int a, int b, int c){
- this.a = a;
- this.b = b;
- this.c = c;
- }
- public double Zwrot(double x){
- return a*(x*x) + b*x + c;
- }
- private double x1,x2;
- public int Licz(){
- double delta = (b*b) - 4 * a * c;
- if(delta > 0){
- x1 = - (Math.sqrt(delta) - b)/ 2*a;
- x2 = - (Math.sqrt(delta) + b)/ 2*a; // maja byc w prywatnych polach, ale nie wiem jak to zrobic
- return 2;
- }
- if(delta == 0) {
- x1 = (-b)/2*a;
- return 1;}
- else return 0;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement