THIS PAPER HAS BEEN DONE AT ESSAYLINK.NET; CONTACT US FOR A SOLUTION
Any code sharing/plagiarism is not tolerated. Show your name and CWID in the background in your captured image as required in all assignments; that is, not providing your name and CWID information in the captured image may result in zero points.
Overview
This project consists of two tasks. The goal is to explore how to design various class through encapsulation, inheritance, composition, and polymorphism, to examine how to create GUI applications using JavaFX. Glance at “What to Submit” when you start working on a task so that you know what information to provide from each task.
Submission Example
CSCI428-project-XX
CSCI428-project-XX.doc
Task1
Shape.java
Drawable.java
Ellipse.java
Circle.java
Triangle.java
Task1XX.java Task2 task2aXX.java GraphViewXX.java graph.txt task2bXX.java
ClockPaneXX.java
README.txt
What to Submit
1. One doc file “CSCI428-project-XX.doc” including two UML class diagrams, the text source code, and screenshots of the outputs of all programs. Please replace XX with your first name and last name. You can copy/paste the text source code from Eclipse, IntelliJIDEA, or other IDEs into the doc file. Hopefully, based on the screen snapshots of the output, you can show that your programs passed tests and were well.
2. Java class files for all programs. In well-defined programs, proper comments are required. For programs without comments, they will be deducted greatly in grade.
3. Note that if any program or code does not work, you can explain the status of the program or code and then attach your explanation and description in a file “README.txt”.
4. Optional. Anything you want to attract the attention of instructor in grading.
Task 1 (50 points): (Shapes) Class, inheritance, polymorphism, and composition (aggregation)
(a) Draw an inheritance hierarchy UML class diagram for shapes from a conceptual perspectiveby referring to [1]. Use Shape as the superclass of the hierarchy. Then extend Shape with two classes TwoDimensionalShape and ThreeDimensionalShape. Continue to extend this hierarchy by adding additional subclasses, such as Circle, Rectangle, Triangle, Sphere, Cube, Cone, and Cylinder, at their correct locations.
(b) Create a class Shape that contains two private data fields: text and filled, and their appropriate accessor and mutator methods. It also contains toString() that returns a string representation of the object. Save it as Shape.java.
(c) Create a interface Drawable that contains three methods draw(), getArea(), and getPerimeter(). Save it as Drawable.java.
(d) Design a class Ellipse that inherits from the class Shape and implements the interface Drawable. It has four new data field centerX, centerY, radiusX, and radiusY. Create all accessor and mutator methods for all new data fields and override the method toString(). Save it as
Ellipse.java.
(e) Design a class Triangle that extends the class Shape and implements the interface Drawable. It has three double data fields named side1, side2, and side3 with default values 1.0 to denote three sides of the triangle. Create all accessor and mutator methods for all three data fields and override the method toString(). Save it as Triangle.java.
(f) Design a class Circle that inherits from the class Ellipse and implements the interface Drawable. It has a new data field radius. Define accessor and mutator methods by overriding and calling the methods defined in its superclass.
(g) Customize the method toString() for each class. If appropriate, consider calling its superclass’s toString() method.
(h) Draw a UML class diagram with the classes and interface designed in Task 1(b)-(f) froma implementation perspective. That is, this diagram contains the details of its respective implementation level [1].
(i) Design a test program to test your designs. The program should have a list including allobjects of classes you have defined in this task. You should create objects in this program by calling different constructors and prompting the user to enter values. Use a loop to display all the objects of different classes and output their information (values of the data fields). Save it as Task1XX.java.
Grading Rubric
– 5 points for providing UML diagram showing the dependencies between the defined classes by referring to the examples at [1] and [2]
– 5 points for defining draft constructor and constructors with multiple parameters to initialize data fields properly
– 5 points for using the keywords super, extends, implements, this properly, reading and writing data from/to files correctly.
– 5 points for calling superclass’s constructors and methods.
– 5 points for overriding superclass’s methods.
– 5 points for using of abstraction (class(s)) and encapsulation (method(s))
– 5 points for using of inheritance (that “is a” relationship) and composition (that “has a” relationship)
– 5 points for using of dynamic binding and proper data structures (arrays and Java collections (ike ArrayList, LinkedList, Set, or Map))
– 5 points for code comments and proper indentations
– 5 points for code testing and design validation
Task 2 (50 points): Write Two(2) GUI programs using JavaFX (not Java AWT or Swing) to finish the following sub-tasks:
(a) A graph consists of vertices and edges that connect vertices. Write a program that reads a graph from a file and displays it on a panel. The first line in the file contains a number that indicates the number of vertices (n). The vertices are labeled as 0, 1, …, n-1. Each subsequent line, with the format u x y v1, v2, …, describes that the vertex u is located at position (x, y)
with edges (u, v1), (u, v2), etc. Figure 1(a) gives an example of the file for a graph. Your program prompts the user to enter the name of the file, reads data from the file, and displays the graph on a panel, as shown in Figure 1(b).
1
//position and edge should be created as followed: 2
3
int[][] positions = new int[n][2]; 4
ArrayList Integer [] edges = new ArrayList[n]; 5 edges[0] = new ArrayList Integer (); 6
//edges[0].add(…); 7
8
//You code will look like this: 9
10
public class Task2aXX extends Application { 11
12
} 13
14
public class GraphViewXX extends Pane { 15
16
} 17
(b) World Clocks: Modify the ClockPane class provided in our lectures to draw the clock with more details on the hours and minutes and use the modified class to show 5 world clocks from different time zones. The first clock show your current Dallas time and date. One time converter can be found at https://24timezones.com/#/map. Note that if time allows, you can also create animation for a running clock for 10 bonus points.
Grading Rubric
– (5 points) for classes with necessary functions and key details as specified in each subtasks.
– (10 points) for the workable classes and functions without any syntax or runtime errors.
– (10 points) for appropriate comments and screen-shots of GUI outputs of the programs.
Challenges in This Project
1. For 10% extra credit, you are welcome to explore the design of each task. Note: You still have to finish all tasks required by this project.
Figure 1: Task2(a): Graph
Figure 2: Task2(b):World Clocks
2. You should install the IntelliJIDEA to facilitate the development of Task 2.
Reference
[1] UML Class Notation. https://www.visual-paradigm.com/guide/uml-unified-modeling-language/ uml-class-diagram-tutorial/
[2] Inheritance. https://icarus.cs.weber.edu/~dab/cs1410/textbook/10.Multiclass_Programs/ inheritance.html
—————x———— Good Luck ————x————–
GET ALL YOUR ACADEMIC HELP AT ESSAYLINK.NET