Question: package rectangle; public class Rectangle { private int height; private int width; public Rectangle(int aHeight, int aWidth) { super(); height = aHeight; width = aWidth;

package rectangle;

public class Rectangle { private int height; private int width;

public Rectangle(int aHeight, int aWidth) { super(); height = aHeight; width = aWidth; }

public int getHeight() { return height; }

public int getWidth() { return width; }

public void setHeight(int aHeight) { height = aHeight; }

public void setWidth(int aWidth) { width = aWidth; }

public int computeArea() { return width * height; }

public int compputeCircumference() { return 2 * (width + height); } }

package rectangle;

import java.util.Scanner;

public class RectangleApp { public static void main(String[] args) { Scanner sc = new Scanner(System.in); System.out.println("Enter height and width of Rectangle: "); Rectangle r = new Rectangle(sc.nextInt(), sc.nextInt()); System.out.println("Area: "+r.computeArea()); System.out.println("Circumference: "+r.compputeCircumference()); } }

Currently, I have these two codes. One is to find the area of a rectangle, and the other is a driver. I have one error in the driver code, in the line " Scanner sc = new Scanner(System.in); ". the sc after Scanner is highlighted as incorrect, and my TA told me I didn't use the Scanner object "sc" you created. Can someone tell me how I can fix this?

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!