Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Funkcija
- package prvi;
- abstract class Funkcija {
- public abstract void nula();
- public abstract double uTojTacki();
- }
- //KvadratniTrinom
- package prvi;
- import java.util.Scanner;
- public class KvadratniTrinom extends Funkcija {
- double a, b, c;
- public KvadratniTrinom() {
- Scanner unesi = new Scanner(System.in);
- a = unesi.nextDouble();
- b = unesi.nextDouble();
- c = unesi.nextDouble();
- nula();
- }
- public void nula(){
- double c = 0;
- int i = 1;
- if ( (a + b) / 2 < a && (a + b) / 2 > b ) {
- System.out.println("Nema resenja!\n");
- return;
- }
- while (a < -b/a && b < -b/2*a) {
- c = (a + b) / Math.pow(2, i);
- i++;
- }
- System.out.printf("%5f", c);
- }
- public double uTojTacki() {
- return 0;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement