Hello, I am currently working on a school project and ran into a little bit of trouble.
Every time I compile the program I get 2 errors they are:
cirlce.java:23: incompatible types
found : java.io.IOException
required: char
letter = get.ioException();
^
cirlce.java:37: possible loss of precision
found : double
required: int
a = pi*r*r;
^
Ive tried everything i could think of. Thank you for looking and helping.
// By:
// Circle program
import java.io.IOException;
import java.util.Scanner;
public class cirlce
{
public static void main(String []args)throws IOException
{
Scanner get = new Scanner(System.in);
double pi = 3.14159265;
int d;
int c;
int a;
float r;
char letter;
System.out.println("Please enter the radius in floating point form: ");
r = get.nextFloat();
System.out.println("Please enter A for Area, D for Diameter, C for Circumfrence: ");
letter = get.ioException();
if(letter == 'd');
{
d = 2*(int)r;
System.out.println("The area of a circle with radius " + r + "is" + d + "Square units");
}
if(letter == 'c');
{
c = 2*(int)pi*(int)r;
System.out.println("The area of a circle with radius " + r + "is" + c + "Square units");
}
if(letter == 'a');
{
a = pi*r*r;
System.out.println("The area of a circle with radius " + r + "is" + a + "Square units");
}
}
}