I'm having trouble writing this exercise in Java , using Eclipse IDE :
Develop a program to calculate the area of the circle.
In this exercise I need to assign Pi (π) the value of 3.1416, and the area calculation is equal to Pi (π), multiplied by the radius squared!
How do I write the "commands" in the Java Language? I started the course this month, or I can only use the basics.
Note: I can enter the radius value, but when I give ENTER the program does not spin!
My code:
import java.io.IOException;
import java.util.Scanner;
public class Exercicio3 {
public static void main(String[] args) {
double raio;
double area;
final double PI = 3.1416;
System.out.println("Escreva o valor do raio");
Scanner scan = new Scanner(System.in);
raio = scan.nextFloat();
area = scan.nextFloat();
area = PI* (raio*raio);
System.out.print("O valor da area é " + area);
System.out.print(area);
scan.close();