For my last and not so hard project i have to ask the user to input the radii of two circles, draw them, and then say if they intersect (if the user inputs a negative radius say they don't). The problem I'm having is that if i try to take r1 which is my user inputted number and apply it to the width/height of the circle it says i cannot use a double for g.drawOval(int,int,int,int);
my code---
import java.awt.*;
import java.applet.*;
import java.io.*;
public class PROJECT extends Applet {
public void init() {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
String input;
try{
System.out.println("Type the radius of the first cricle.");
input = in.readLine();
r1 = getNumber(input);
System.out.println("Type the radius of the second cricle.");
input = in.readLine();
r2 = getNumber(input);
}catch(IOException e){}
}
public double getNumber(String input){
double d;
try{
d = Double.parseDouble(input);
} catch(NumberFormatException nfe){
d = Double.NaN;
}
return d;
}
public void paint(Graphics g) {
Color bg = new Color(240, 0, 100);
Color ivory = new Color(240, 240, 240);
setBackground(bg);
g.drawString("Welcome to Java!!", 50, 60 );
g.setColor(ivory);
g.fillOval(20,50,r1,r1);
}
double r1;
double r2;
}
the error--
--------------------Configuration: PROJECT - JDK version 1.5.0_07 <Default> - <Default>--------------------
C:\Program Files\Xinox Software\JCreatorV3LE\MyProjects\LastProj\PROJECT\src\PROJECT.java:52: fillOval(int,int,int,int) in java.awt.Graphics cannot be applied to (int,int,double,double)
g.fillOval(20,50,r1,r1);
^
1 error
Process completed.