Placeholder

CSIS 212 Programming Assignment 7 Rectangle Class

$19.00

Description

Exercise 8.4 JHTP (Rectangle Class): Create a class Rectangle with attributes length and width, each of which defaults to 1. Provide methods that calculate the rectangle’s perimeter and area. Use set and get methods for both length and width. The set methods will verify that length and width are each floating-point numbers larger than 0.0 and less than 20.0. Write a program to test class Rectangle.
This assignment is due by 11:59 p.m. (ET) on Monday.
Notes:
1. In the test class write code to create and print a menu that returns a value corresponding to the menu choice.
2. Also in the test file, remember to code a Try Catch Illegial Argument Expection to determine if the user entered a length and width of 0.0-20.
SCREENSHOTS
SOLUTION
PAYMENT
CSIS212 Assignment 7 Report
CSIS212 Assignment 7 Screenshot
The solution consists of:
A report word document for this assignment
All Java programs in case you want to run theses programs on your computer.
Screenshots while running programs
Attachments [Move over files to preview content of those files]
CSIS212_Assignment_7.zip (377.80 KB)
CSIS212-Assignment-7-Report-Screenshot.png
CSIS212-Assignment-7-Screenshot-1.png
CSIS_212_Assignment_7_Report.docx
Source Code
Rectangle.java
TestRectangle.java
Preview Rectangle.java
xxxxxx xxxxxx xxxxxxxxx() {
xxxxxx xxxx.xxxxxx;
}
xxxxxx xxxx xxxxxxxxx(xxxxxx xxxxxx) xxxxxx xxxxxxxxx {
if (length < 0 || length > 20) throw new Exception(“Invalid length, width must larger than 0.0 and less than 20.0”); this.length = length; }
public double getWidth() { return this.width; }
public void setWidth(double width) throws Exception { if (width < 0 || width > 20) throw new Exception(“Invalid width, width must larger than 0.0 and less than 20.0”);
xxxx.xxxxx = xxxxx;
}
// xxxxxxxxx xxxxxxxxx
xxxxxx xxxxxx xxxxxxxxx() {
xxxxxx (xxxxx + xxxxxx) * 2;
Preview TestRectangle.java
xxxxxx.xxx.xxxxxxx(“5. xxxx”);
}
xxxxxx xxxxxx xxxx xxxx(xxxxxx[] xxxx) {
xxxxxxx xxxxx = xxx xxxxxxx(xxxxxx.xx);
Rectangle rect = new Rectangle(); try { int choice = 0; while (choice != 5) { System.out.println(“Enter your choice (1-5):”); choice = input.nextInt(); switch (choice) { case 1: System.out.println(“Enter length: “); double length = input.nextDouble(); rect.setLength(length); break;
xxxx 2:
xxxxxx.xxx.xxxxxxx(“xxxxx xxxxx: “);
xxxxxx xxxxx = xxxxx.xxxxxxxxxx();
xxxx.xxxxxxxx(xxxxx);
xxxxx;
xxxx 3:
Price: $19
You May Also Like:
CSIS 212 Programming Assignment 1 Create Five Programs
CSIS 212 Programming Assignment 2 Salary Calculator
CSIS 212 Programming Assignment 3 Bar Chart Printing Program
CSIS 212 Programming Assignment 4 Multiples Circle Area Computer-Assisted Instruction
CSIS 212 Programming Assignment 5 Variable-Length Argument List Dice Rolling
CSIS 212 Programming Assignment 6 Date Class
CSIS 212 Programming Assignment 8 Payroll Modification

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.