Rectangle.java /** * Models a rectangle with a width and length. */ 4 public class Rectangle { // Instance variables 6 8 9 /** 10 * Constructs a new rectangle with default width and length (0.0) */ public Rectangle() { } 11 12 13 14 15 16 /** Constructs a new rectangle with the given width and length @param newwidth the width of this Rectangle object * @param newlength the length of this Rectangle object 17 18 19 20 */ 21 public Rectangle(double newwidth, double newLength) { } 22 23 24 /** * Gets the width of this Rectangle * @return the width of this rectangle 25 26 27 28 public double getwidth() { return e; } 29 30 31 32 33 34 /** * Gets the length of this Rectangle * @return the length of this rectangle */ 35 36 37 public double getlength() { return e; } 38 39 40 41 42 43 /** 44 * Sets a new width for this Rectangle 45 * @param awidth the new width for this Rectangle 46 47 public void setwidth(double awidth) 48 49 } 50 51 /** * Sets a new length for this Rectangle * @param alength the new length for this Rectangle 52 53 54 55 public void setlength(double alength) { } 56 57 58 /** * Calculates the area of this Rectangle * @return the area of this Rectangle * / 59 60 61 62 63 public double area() { 64 65 return e; 66 } 67 68 /** 69 Calculates the perimeter of this Rectangle * @return the perimeter of this Rectangle 70 71 public double perimeter() { 72 73 74 return e; 75 } 76 /** * Prints the dimensions for width and length. * Includes labels for Width: and Length: and display * the values to 2 decimal places. Print a new line at the end. 77 78 79 80 81 * / public void printDimensions ( ) { } 82 83 84 85

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
100%
Rectangle.java
/**
* Models a rectangle with a width and length.
*/
4
public class Rectangle
{
// Instance variables
6
8
9
/**
10
* Constructs a new rectangle with default width and length (0.0)
*/
public Rectangle()
{
}
11
12
13
14
15
16
/**
Constructs a new rectangle with the given width and length
@param newwidth the width of this Rectangle object
* @param newlength the length of this Rectangle object
17
18
19
20
*/
21
public Rectangle(double newwidth, double newLength)
{
}
22
23
24
/**
* Gets the width of this Rectangle
* @return the width of this rectangle
25
26
27
28
public double getwidth()
{
return e;
}
29
30
31
32
33
34
/**
* Gets the length of this Rectangle
* @return the length of this rectangle
*/
35
36
37
public double getlength()
{
return e;
}
38
39
40
41
42
43
/**
44
* Sets a new width for this Rectangle
45
* @param awidth the new width for this Rectangle
46
47
public void setwidth(double awidth)
48
49
}
50
51
/**
* Sets a new length for this Rectangle
* @param alength the new length for this Rectangle
52
53
54
55
public void setlength(double alength)
{
}
56
57
58
/**
* Calculates the area of this Rectangle
* @return the area of this Rectangle
* /
59
60
61
62
63
public double area()
{
64
65
return e;
66
}
67
68
/**
69
Calculates the perimeter of this Rectangle
* @return the perimeter of this Rectangle
70
71
public double perimeter()
{
72
73
74
return e;
75
}
76
/**
* Prints the dimensions for width and length.
* Includes labels for Width: and Length: and display
* the values to 2 decimal places. Print a new line at the end.
77
78
79
80
81
* /
public void printDimensions ( )
{
}
82
83
84
85
Transcribed Image Text:Rectangle.java /** * Models a rectangle with a width and length. */ 4 public class Rectangle { // Instance variables 6 8 9 /** 10 * Constructs a new rectangle with default width and length (0.0) */ public Rectangle() { } 11 12 13 14 15 16 /** Constructs a new rectangle with the given width and length @param newwidth the width of this Rectangle object * @param newlength the length of this Rectangle object 17 18 19 20 */ 21 public Rectangle(double newwidth, double newLength) { } 22 23 24 /** * Gets the width of this Rectangle * @return the width of this rectangle 25 26 27 28 public double getwidth() { return e; } 29 30 31 32 33 34 /** * Gets the length of this Rectangle * @return the length of this rectangle */ 35 36 37 public double getlength() { return e; } 38 39 40 41 42 43 /** 44 * Sets a new width for this Rectangle 45 * @param awidth the new width for this Rectangle 46 47 public void setwidth(double awidth) 48 49 } 50 51 /** * Sets a new length for this Rectangle * @param alength the new length for this Rectangle 52 53 54 55 public void setlength(double alength) { } 56 57 58 /** * Calculates the area of this Rectangle * @return the area of this Rectangle * / 59 60 61 62 63 public double area() { 64 65 return e; 66 } 67 68 /** 69 Calculates the perimeter of this Rectangle * @return the perimeter of this Rectangle 70 71 public double perimeter() { 72 73 74 return e; 75 } 76 /** * Prints the dimensions for width and length. * Includes labels for Width: and Length: and display * the values to 2 decimal places. Print a new line at the end. 77 78 79 80 81 * / public void printDimensions ( ) { } 82 83 84 85
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Random Class and its operations
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education