Question: I am working on my rectanglar calculator in Java. I was comparing my code mport java.util.Scanner; public class RectangleCalculator { public static void main (

I am working on my rectanglar calculator in Java. I was comparing my code mport java.util.Scanner;
public class RectangleCalculator {
public static void main(String[] args){
Scanner input = new Scanner(System.in);
System.out.println("Welcome to the Area and Perimeter Calculator");
boolean continueCalculations = true;
while (continueCalculations){
System.out.print("Enter length: ");
double length = input.nextDouble();
System.out.print("Enter width: ");
double width = input.nextDouble();
double area = width * length;
double perimeter =2* width +2* length;
System.out.println("Area: "+ area);
System.out.println("Perimeter: "+ perimeter);
System.out.print("Continue?(y/n): ");
String userChoice = input.next();
continueCalculations = userChoice.equalsIgnoreCase("y");
}
}
}with the example given and the example is also incorrect, please help???

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!