Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Description question3.zip contains 5 classes that represent a simple 2D graphics-drawing programme. The Point class represents a pair of x, y coordinates The Rectangle class

Description question3.zip contains 5 classes that represent a simple 2D graphics-drawing programme.

The Point class represents a pair of x, y coordinates

The Rectangle class represents a 2-dimensional rectangle. It is defined by a Point representing its top left-hand corner x,y coordinates and its width and height.

A Circle class represents a 2-dimensional circle. It is defined by a Point representing its center point and its radius.

The Drawing Class represents a collection of simple shapes (e.g rectangles and/or circles). It can also contain another Drawing object.

The main method is in the Draw class. It demonstrates the functionality of the program. Based on input parameters, the program creates a simple Car shape (see Figure 3.1)

It does this by creating two Drawing objects: Car and Chasis

The car Drawing object is composed of a two Rectangle Objects: body and top.

The chassis Drawing object is composed of two Circles: wheel1 and wheel2

The program adds the chassis Drawing object to the car Drawing object.

Finally, the program prints out the overall area of the car drawing an object and the number of shapes it is composed of.

The overall area is simply the sum of the areas of the shapes.

You dont have to take into account if they overlap. What you have to do: You are required to make this program work so that it:

1. Compiles correctly and demonstrates the correct implementation of constructors, methods and access control [6]

2. Prints out the correct overall area of the shapes and number of shapes involved. Demonstrate this by uploading a screenshot of the Java output. [6]

3. Demonstrates an appropriate use of inheritance and polymorphism as a key part of your solution [8]

The area of a circle is PI * radius* radius. In Java the value of PI is given by Math.PI What to submit

A pdf file for each class that youve modified or created

A screenshot showing the output e.g. the overall area is 20 units squared

A short description of what youve done. If youve had problems, this is the place to explain where youve had problems and your ideas for solving them (e.g. if you had more time)

image text in transcribed

to body wheell wheel2 to body wheell wheel2

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Case Studies In Business Data Bases

Authors: James Bradley

1st Edition

0030141346, 978-0030141348

More Books

Students also viewed these Databases questions

Question

13-1 How does building new systems produce organizational change?

Answered: 1 week ago