Java Lab Exercise 3
Java Lab Exercise 3
1. Write a Java program that defines a class Rectangle with the following attributes:
1. setValues(double len, double wid): A method to set the values of length and
width.
2. calculateArea(): A method that returns the area of the rectangle.
3. display(): A method that prints the length, width, and area of the rectangle.
2. Write a Java program that takes n integers as input from the user, stores them in an array, and
finds the maximum element in the array.
3. Write a Java program that takes an array of n integers as input from the user and prints the array
in reverse order.
4. Write a Java program that takes n integers as input from the user, stores them in an array, and
counts how many numbers are even and how many are odd.