1. Member
Join Date
Oct 2010
Posts
1
Rep Power
0

## quadratic equation, problems that i can't solve

Java Code:
```import java.io.*;
import javax.swing.JOptionPane;

{
//static float a, b, c, delta;
//static String pomocniczy;
//static double x, x1, x2;

public static void main(String[] args)
{
float a, b, c;
String pomocniczy;
double x, x1, x2, delta;

pomocniczy=JOptionPane.showInputDialog(null, "Podaj wspolczynnik a równania kwadratowego: ");
a=Float.parseFloat(pomocniczy);
pomocniczy=JOptionPane.showInputDialog(null, "Podaj wspolczynnik b równania kwadratowego: ");
b=Float.parseFloat(pomocniczy);
pomocniczy=JOptionPane.showInputDialog(null, "Podaj wspolczynnik c równania kwadratowego: ");
c=Float.parseFloat(pomocniczy);
if (a!=0)
{
delta=(b*b)-(4*a*c);
if (delta<0) System.out.println("Delta mniejsza od 0. Brak pierwiastkow rzeczywistych.");
if (delta==0)
{
x=(-b)/(2*a);
System.out.println("Jeden pierwiastek podwojny x=" + x);

}
if (delta>0)
{
x1=	(-b - Math.sqrt(delta))/2*a;
x2 =(-b + Math.sqrt(delta))/2*a;
System.out.println("Dwa pierwiastki rzeczywiste x1="+ x1 + " x2="+ x2);
}
}
else System.out.println("To nie rownanie kwadratowe. Nie mozna liczyc pierwiastkow.");

System.exit(0);
}
}```
here are the errors:
1. Description Resource Path Location Type
Syntax error on token "0", delete this token Zadanie2.java /Zadanie2/src line 47 Java Problem

2. Description Resource Path Location Type
Syntax error on token "Invalid Character", invalid AssignmentOperator Zadanie2.java /Zadanie2/src line 40 Java Problem

3. Description Resource Path Location Type
Syntax error on token(s), misplaced construct(s) Zadanie2.java /Zadanie2/src line 47 Java Problem

4. Description Resource Path Location Type
The left-hand side of an assignment must be a variable Zadanie2.java /Zadanie2/src line 40 Java Problem

i don't know extacly what i did do wrong :/ can you help me? I'm new in java...that's my first program here...
Last edited by kourai; 10-14-2010 at 11:49 AM.

2. Originally Posted by kourai
[code]
here are the errors:
1. Description Resource Path Location Type
Syntax error on token "0", delete this token Zadanie2.java /Zadanie2/src line 47 Java Problem
The source code you posted has only 46 lines ...

kind regards,

Jos

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•