2
I’m having trouble writing this exercise in Language Java, using the IDE Eclipse:
Develop a program to calculate the area of the circle.
In this precise exercise assign to Pi (π) the value of 3.1416, where the area calculation is equal to Pi(π), multiplied by the radius squared!
How should I write "commands" in the Java language? I started the course this month, which means I can only use the basics.
Note: I can type the radius value, but when I give ENTER the program does not run!
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();
Hi Carol when you say that "wheel" does not present any error in the ecplise console or simply stops working ?
– Viktor Hugo
Viktor Hugo - I click on RUN ,he asks me to type the Ray,I type and then nothing occurs. he does not calculate the area
– Carol M
You’re asking for two values, the
raio
and thearea
, soon the program is waiting for the 2– Isac
Isac, then I have to besides typing the value of Ray type the Pi which in my case is : 3.1416?
– Carol M
I reversed the changes because your code is misspelled in the question.
– Valdeir Psr
Valdeir Psr - excuse my "stupid" what is wrong? because I want to edit to get straight kk
– Carol M
There was nothing wrong, as Iscac said... after you typed the lightning he asked for you to enter the area value.
– Viktor Hugo