Prepare an abstract class called shape

Assignment Help JAVA Programming
Reference no: EM131585696

Programming - Assignment

Please ensure that relevant java files are submitted in the correct assignment folder on AUT online by midnight on the due date. Only classes from the Java standard library may be used for this assignment. Best to zip up all java files and place into a folder with your full name and student ID.

Question 1)

Prepare an abstract class called Shape for representing a general shape that can be drawn on the screen, using the following UML diagram as a guide. It should have a default constructor as well as a constructor that specifies a starting point for the shape, accessor and mutator methods for the colour of the shape, a mutator method for specifying a control point which determines the size of the shape, and an abstract draw method for drawing the shape based on the starting and control points

996_Figure.jpg

Question 2)
Prepare an interface called EnclosesRegion for representing the property possessed by those shapes which enclose a region (and so have an interior). It should include a method setFilled for determining whether the shape is drawn with its interior filled in.

2040_Figure1.jpg

Question 3)
Design and implement classes Line, Oval, Circle, Rectangle, and Square for representing particular shapes. Pay careful attention to the hierarchy of these classes with respect to each other, and their relationship with Shape and EnclosesRegion. The Line class prepares a straight line between its start point and its control point. The classes Oval and Circle use the start point for their centre and the control point for the edge of the shape. However, Rectangle and Square use these points for opposite corners (the width of a Square is determined by the horizontal position of the control point).

Question 4)
Prepare a GUI panel called ShapeSketcher for drawing a collection of shapes. It should contain a set of five radio buttons for choosing the next shape to add to the sketch, a checkbox for whether or not the next shape should be filled in, a button for changing the colour used (the class JColorChooser might be useful), as well as a panel containing the sketch. Each shape is added to the sketch by rubberbanding, dragging the mouse from its start point to a control point, with the shape being resized while the mouse is dragged. Whenever the mouse is dragged in a horizontal or vertical direction, the user should be informed by the letter H or V appearing alongside the current mouse position. HINT: May be useful to create an innerclass which also extends JPanel of a fixed size to handle the drawing of shapes and listening for events. Also recommended to place your other "J" components in another separate panel. Essentially ShapeSketcher should extend JPanel and contain two more panels, one for holding the components and one for drawing the shapes and listening for MouseEvent objects. Put all your JFrame setup inside the main method.

Question 5)
Further modify the ShapeSketcher class so that it also contains buttons for opening and saving sketches. Make the appropriate changes to Shape so that each shape can be serialized to a file using appropriate filtering streams. The user should be asked what file to open and save to using a JFileChooser. Make sure appropriate exceptions are handled and displayed to user with a JOptionPane.showMessageDialog method if the user tries to open an invalid file.

Reference no: EM131585696

Questions Cloud

Find three new planar drawings of the right-hand graph : Add up the sizes of the faces in each graph drawing you have made. What seems to be true about the sum of the face sizes of a graph? Explain why this is so.
Dividend chronology-who gets the dividends on those shares : When is the ex-dividend date? If a shareholder buys stock before that date, who gets the dividends on those shares, the buyer or the seller?
Importance in today competitive environment : For this discussion forum, pretend that you work for a marketing firm. Knowing that effective marketing is of increasing importance in today's competitive.
Demonstrate you understand and can apply : Use specific sociological terms and concepts from the textbook reading in your paper to demonstrate you understand and can apply the concepts.
Prepare an abstract class called shape : Design and implement classes Line, Oval, Circle, Rectangle, and Square for representing particular shapes - Prepare a GUI panel called ShapeSketcher for drawing
Consumer be harmed utilizing concept : How might both the manufacturer and the end-consumer be harmed utilizing this concept? Document your sources.
How many faces total does each drawing have : Find two different planar drawings of the left-hand graph of Figure, each of which has a face of size 6. How many faces, total, does each drawing have?
Opportunity to develop a balanced scorecard : Students will have the opportunity to develop a Balanced Scorecard. This, in turn, will allow them to create effective strategic objectives.
Organization structure that you chose : In your discussion, include the pros and cons of each and explain your reason for choosing the organization structure that you chose.

Reviews

Write a Review

JAVA Programming Questions & Answers

  Recursive factorial program

Write a class Array that encapsulates an array and provides bounds-checked access. Create a recursive factorial program that prompts the user for an integer N and writes out a series of equations representing the calculation of N!.

  Hunt the wumpus game

Reprot on Hunt the Wumpus Game has Source Code listing, screen captures and UML design here and also, may include Javadoc source here.

  Create a gui interface

Create GUI Interface in java programing with these function: Sort by last name and print all employees info, Sort by job title and print all employees info, Sort by weekly salary and print all employees info, search by job title and print that emp..

  Plot pois on a graph

Write a JAVA program that would get the locations of all the POIs from the file and plot them on a map.

  Write a university grading system in java

University grading system maintains number of tables to store, retrieve and manipulate student marks. Write a JAVA program that would simulate a number of cars.

  Wolves and sheep: design a game

This project is designed a game in java. you choose whether you'd like to write a wolf or a sheep agent. Then, you are assigned to either a "sheep" or a "wolf" team.

  Build a graphical user interface for displaying the image

Build a graphical user interface for displaying the image groups (= cluster) in JMJRST. Design and implement using a Swing interface.

  Determine the day of the week for new year''s day

This assignment contains a java project. Project evaluates the day of the week for New Year's Day.

  Write a java windowed application

Write a Java windowed application to do online quiz on general knowledge and the application also displays the quiz result.

  Input pairs of natural numbers

Java program to input pairs of natural numbers.

  Create classes implement java interface

Interface that contains a generic type. Create two classes that implement this interface.

  Java class, array, link list , generic class

These 14 questions covers java class, Array, link list , generic class.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd