Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Java Expert


Home >> Java

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.

Java, Programming

  • Category:- Java
  • Reference No.:- M92394410
  • Price:- $35

Priced at Now at $35, Verified Solution

Have any Question?


Related Questions in Java

Assessment socket programmingtaskwrite a java gui program

Assessment: Socket Programming Task Write a JAVA GUI program that would facilitate text chatting/exchanging between two or multiple computers over the network/internet, using the concept of JAVA socket programming. If yo ...

Assignment taskwrite a java console application that allows

Assignment task Write a java console application that allows the user to read, validate, store, display, sort and search data such as flight departure city (String), flight number (integer), flight distance (integer), fl ...

Simple order processing systemquestion given the classes

Simple Order Processing System Question: Given the classes Ship (with getter and setter), Speedboat, and SpeedboatTest. Answer the following questions: Refine the whole application (all classes) and create Abstract class ...

Applied software engineering assignment 1 -learning

Applied Software Engineering Assignment 1 - Learning outcomes - 1. Understand the notion of software engineering and why it is important. 2. Analyse the risk factors associated with phases of the software development lif ...

Assessment database and multithread programmingtasktask 1

Assessment: Database and Multithread Programming Task Task 1: Grade Processing University grading system maintains a database called "GradeProcessing" that contains number of tables to store, retrieve and manipulate stud ...

Project requirementsfor the problem described in the next

Project requirements For the problem described in the next section, you must do the following: 1. include your student ID at the end of all filenames for all java code files. Three classes have been identified in section ...

Assessment database and multithread programmingtasktask 1

Assessment: Database and Multithread Programming Task Task 1: Grade Processing University grading system maintains a database called "GradeProcessing" that contains number of tables to store, retrieve and manipulate stud ...

Operating systems assignment -problem 1 sharing the bridgea

Operating Systems Assignment - Problem 1: Sharing the Bridge A new single lane bridge is constructed to connect the North Island of New Zealand to the South Island of New Zealand. Farmers from each island use the bridge ...

Assessment instructionsin this assessment you will design

Assessment Instructions In this assessment, you will design and code a simple Java application that defines a class, instantiate the class into a number of objects, and prints out the attributes of these objects in a spe ...

Solving 2nd degree equationsbull write the following java

Solving 2nd degree equations • Write the following Java methods • boolean real-sols(double a, double b, double c): it returns true if the 2nd degree equation ax2 + bx + c has real solutions • double solution1(double a, d ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As