Q1: Write the Java code corresponding to the following UML diagram. The class School implements the interface Building. The method computeArea returns the area of the building as width * length. After that, add a testing class with a main method which defines an arrayList that contains three objects. From the main method, print the area of all the three objects. Building « Interface >> + computeArea() : double + toString() : String School - classroomNum: int |- width: double |- length: double + School(classroomNum: int, width: double, length: double) + computeArea() : double + toString() : String

Microsoft Visual C#
7th Edition
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Joyce, Farrell.
Chapter9: Using Classes And Objects
Section: Chapter Questions
Problem 19RQ
icon
Related questions
Question

Write the Java code corresponding to the following UML diagram. The class School implements the interface Building. The method computeArea returns the area of the building as width * length. After that, add a testing class with a main method which defines an arrayList that contains three objects. From the main method, print the area of all the three objects.

Q1: Write the Java code corresponding to the following UML diagram. The class School implements the
interface Building. The method computeArea returns the area of the building as width * length. After that,
add a testing class with a main method which defines an arrayList that contains three objects. From the
main method, print the area of all the three objects.
Building
« Interface >>
+ computeArea() : double
+ toString() : String
School
- classroomNum: int
|- width: double
|- length: double
+ School(classroomNum: int, width: double, length: double)
+ computeArea() : double
+ toString() : String
Transcribed Image Text:Q1: Write the Java code corresponding to the following UML diagram. The class School implements the interface Building. The method computeArea returns the area of the building as width * length. After that, add a testing class with a main method which defines an arrayList that contains three objects. From the main method, print the area of all the three objects. Building « Interface >> + computeArea() : double + toString() : String School - classroomNum: int |- width: double |- length: double + School(classroomNum: int, width: double, length: double) + computeArea() : double + toString() : String
Expert Solution
steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Knowledge Booster
Adjacency Matrix
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.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,