Question: Lab Exercises Exercise 1-Rhombus Exercise Objectives Class and Object Problem Description Part 1: Declare a java class named Rhombus that has the following members: a.
Lab Exercises Exercise 1-Rhombus Exercise Objectives Class and Object Problem Description Part 1: Declare a java class named Rhombus that has the following members: a. Constructor b. Three private members: Diagonal-1, Diagonal-2, and side. C.three member functions: 1. setSides: sets the Diagonal-1,Diagonal-2 and side of Rhombus. 2. Area: Computes the area of the Rhombus object. //area=(d1d2)/2 3. Perimeter: Computes the perimeter of the Rhombus object. //perimeter 4 side Part 2: write a driver Test program that performs the following: 1. Create an object names myRhombus, and an array of objects of type Rhombus. 2. Set myRhombus Diagonal-1 to 5, Diagonal-2 to 7, and side to 6. 3. Compute and print myRhombus's area and perimeter using object name. 4. Set the Diagonal-1, Diagonal-2, and side of the first 4 myRhombus objects of The array, compute and prints their area and perimeter. Acti Go to
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
