Purpose: To write an Object-Oriented application that creates a Java class with several instance variables, a...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Purpose: To write an Object-Oriented application that creates a Java class with several instance variables, a constructor to initialize the instance variables, several methods to access and update the instance variables' values, along with other methods to perform calculations. Also, write a test class that instantiates the first class and tests the class's constructor and methods. Details: Create a class called Rectangle containing the following: . Two instance variables, An instance variable of type double used to hold the rectangle's width. o An instance variable of type double used to hold the rectangle's height. Provide a constructor with two parameters used to initializes each instance variable. The constructor should verify that the specified width and height values are greater than 0.0 and less than or equal to 20.0. If they are not, indicate an exception has occurred. Provide get methods that return the values of each instance variables. Provide set methods that set the instance variables to new values. The methods should also verify that the specified width and height values are greater than 0.0 and less than or equal to 20.0. If they are not, indicate an exception has occurred. Provide a method called calculatePerimeter that calculates the perimeter of the rectangle and return that value as a double. Provide a method called calculateArea that calculates the area of the rectangle and returns that value as a double. Create a second class called Rectangle Test that contains the main method, and thoroughly tests the Rectangle class's methods. This test class does not need to ask users for input. Just create the needed Rectangle objects to ensure that you test the Rectangle class's methods well. The thoroughness of your testing in will impact your grade. Upload both source files to Blackboard. Note: Ensure that your program is properly formatted and it follows all Java naming conventions. AIT 500 - Programming Assignment (Michael Boehmer) Purpose: To write an Object-Oriented application that creates a Java class with several instance variables, a constructor to initialize the instance variables, several methods to access and update the instance variables' values, along with other methods to perform calculations. Also, write a test class that instantiates the first class and tests the class's constructor and methods. Details: Create a class called Rectangle containing the following: . Two instance variables, An instance variable of type double used to hold the rectangle's width. o An instance variable of type double used to hold the rectangle's height. Provide a constructor with two parameters used to initializes each instance variable. The constructor should verify that the specified width and height values are greater than 0.0 and less than or equal to 20.0. If they are not, indicate an exception has occurred. Provide get methods that return the values of each instance variables. Provide set methods that set the instance variables to new values. The methods should also verify that the specified width and height values are greater than 0.0 and less than or equal to 20.0. If they are not, indicate an exception has occurred. Provide a method called calculatePerimeter that calculates the perimeter of the rectangle and return that value as a double. Provide a method called calculateArea that calculates the area of the rectangle and returns that value as a double. Create a second class called Rectangle Test that contains the main method, and thoroughly tests the Rectangle class's methods. This test class does not need to ask users for input. Just create the needed Rectangle objects to ensure that you test the Rectangle class's methods well. The thoroughness of your testing in will impact your grade. Upload both source files to Blackboard. Note: Ensure that your program is properly formatted and it follows all Java naming conventions. AIT 500 - Programming Assignment (Michael Boehmer)
Expert Answer:
Related Book For
Java How To Program Late Objects Version
ISBN: 9780136123712
8th Edition
Authors: Paul Deitel, Deitel & Associates
Posted Date:
Students also viewed these programming questions
-
CANMNMM January of this year. (a) Each item will be held in a record. Describe all the data structures that must refer to these records to implement the required functionality. Describe all the...
-
Follow the instructions below.This program provides a simplified example for selling tickets for three theaters within a movie house.In order to better reflect Object-Oriented principle, much of the...
-
machine element is made of an alloy with Yield strength of 200 Mpa and fracture strain is 0.08. A machine element is characterized by the normal stress components as shown in the figure. The Answer...
-
In Exercise 10.46, you compared the property evaluations of two tax assessors, A and B. Their assessments for eight properties are shown in the table: a. Use the sign test to determine whether the...
-
Two athletic teams play a series of games; the first team to win 4 games is declared the overall winner. Suppose that one of the teams is stronger than the other and wins each game with probability...
-
The chapter provides sample goals for an initial sales call on a prospect. (a) What other goals can you come up with that might be appropriate for an initial sales call? (b) Develop three or four...
-
Examine and compare one of the following product sets. Base your comparison on such factors as features, costs, convenience, ease of use, and value. a. GPS versus maps. b. Cell phones versus...
-
2.) What is the specific goal of this lab? Exactly what question are you trying to answer? Be as specific as possible. ("To learn about topic X..." is not specific!) 3.) What specific measurements or...
-
Three phase balanced star connected load when supplied from three phase three wire 400 V, 50 Hz source takes a line current of X Amperes at Yo w.r.t its line voltage. Phase sequence is RYB. Question...
-
How would you define BPM and explain each of the key words and phrases in your definition?
-
Describe the difference between employee satisfaction and service.
-
Why is people change management important and how much effort should a BPM program expend on it?
-
Chris and James Simon are in their mid-30s and have two children, ages 8 and 5. They have combined annual income of $95,000 and own a house in joint tenancy with a market value of $310,000, on which...
-
Why is employee-centricity alone not enough?
-
An executive conference center has the physical ability to handle 1,100 participants. However, conference management personnel believe that only 1,000 participants can be handled effectively for most...
-
At the beginning of its fiscal year, Lakeside Inc. leased office space to LTT Corporation under a seven-year operating lease agreement. The contract calls for quarterly rent payments of $25,000 each....
-
\(X\) is the number of bits in error in the next four bits transmitted. What is the expected value of the square of the number of bits in error? Now, \(h(X)=X^{2}\). Therefore, \[ \begin{aligned}...
-
In Example 4.1, \(X\) is the current measured in milliamperes. What is the expected value of power when the resistance is 100 ohms?
-
Correlation between height and weight for players on the 2014 Brazil World Cup Team, using data from all 23 players on the roster. State whether the quantity described is a parameter or a statistic...
Study smarter with the SolutionInn App