When Using this code: import java.util.Scanner; public class Main { public stati
ID: 3917260 • Letter: W
Question
When Using this code:
import java.util.Scanner;
public class Main
{
public static double perimeterRectangle(double length, double width)
{
double perimeter; // variable declarartion
perimeter=2*(length+width); // Find perimeter of rectangle
return perimeter; // return perimeter of rectangle
}
public static void main(String [] arg)
{
Scanner keyboard=new Scanner(System.in);
double length, width,perimeter;
System.out.printf("Please enter length of rectangle:");
length=keyboard.nextDouble(); // Accept length
System.out.printf("Please enter length of rectangle:");
width=keyboard.nextDouble(); // Accept width
perimeter=perimeterRectangle(length, width); // calling function
System.out.printf("Perimeter of rectangle is %.2f ", perimeter); // print perimeter of a rectangle
}
}
Or this code :
Explanation / Answer
This happens mostly if you don't have JDK installed on your machine or the path to the JDK is not set properly. Cross check the JDK installation and the JDK path. Please share other information like OS, Java version installed etc. if you are still facing the issue.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.