Program 7
Program 7
Javac ResizeDemo.java
Java ResizeDemo.java
import java.util.Scanner;
// Interface Resizable
interface Resizable {
void resizeWidth(int width); // Method to resize width
void resizeHeight(int height); // Method to resize height
}
// Getting the initial width and height of the rectangle from the user
System.out.print("Enter the initial width of the rectangle: ");
int initialWidth = sc.nextInt();
// Getting new dimensions for resizing the rectangle from the user
System.out.print("\nEnter the new width to resize the rectangle: ");
int new Width = sc.nextInt();