Chat with us, powered by LiveChat This project consists of two tasks. The goal is to explore how to design various class through encap sulation, inheritance, c - School Writers

This project consists of two tasks. The goal is to explore how to design various class through encap sulation, inheritance, c

This project consists of two tasks. The goal is to explore how to design various class through encap sulation, 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. 

Please Check the attached Details. Thank you 

package sample; import javafx.scene.layout.Pane; import javafx.scene.paint.Color; import javafx.scene.shape.Circle; import javafx.scene.shape.Line; import javafx.scene.text.Text; import java.util.Calendar; import java.util.GregorianCalendar; public class ClockPane extends Pane { private int hour; private int minute; private int second; // Clock pane's width and height private double w = 250, h = 250; // default constructor that is going to construct a clock with the current time public ClockPane(){ setCurrentTime(); } public ClockPane(int hour, int minute, int second) { this.hour =hour; this.minute = minute; this.second=second; paintClock(); } public int getHour() { return this.hour; } public int getMinute() { return this.minute; } public int getSecond() { return this.second; } /** Return clock pane's width */ public double getW() { return w; } /** Set clock pane's width */ public void setW(double w) { this.w = w; paintClock(); } /** Return clock pane's height */ public double getH() { return h; } /** Set clock pane's height */ public void setH(double h) { this.h = h; paintClock(); } public void setHour(int hour) { this.hour=hour; paintClock(); } public void setMinute(int minute) { this.minute=minute; paintClock(); } public void setSecond(int second) { this.second=second; paintClock(); } public void setCurrentTime(){ Calendar calendar = new GregorianCalendar(); this.hour =calendar.get(Calendar.HOUR_OF_DAY); this.minute =calendar.get(Calendar.MINUTE); this.second = calendar.get(Calendar.SECOND); // paint/repaint our pane paintClock(); } public void paintClock() { //Initialize clock parameters double clockRadius = Math.min(getWidth(),getHeight())*0.4; double centerX = getWidth()/2; double centerY =getHeight()/2; //Draw Clock/circle Circle circle = new Circle(centerX,centerY,clockRadius); circle.setFill(Color.WHITE); circle.setStroke(Color.BLACK); Circle circle2 = new Circle(centerX,centerY,clockRadius*0.05); //circle2.setFill(Color.WHITE); circle2.setStroke(Color.BLACK); //Add some texts Text t1 = new Text(centerX-5,centerY-clockRadius+12,"12"); Text t2 = new Text(centerX-clockRadius+3,centerY-5,"9"); Text t3 = new Text(centerX+clockRadius-10,centerY+3,"3"); Text t4 = new Text(centerX-3,centerY+clockRadius-3,"6"); //Draw the second hand double sLength = clockRadius*0.9; double secondX = centerX+sLength*Math.sin(this.second*(2*Math.PI/60)); double secondY = centerY-sLength*Math.cos(this.second*(2*Math.PI/60)); Line sLine = new Line(centerX,centerY,secondX,secondY); sLine.setStroke(Color.RED); sLine.setStrokeWidth(2); //Draw the minute hand double mLength = clockRadius*0.7; double minuteX = centerX+mLength*Math.sin(this.minute*(2*Math.PI/60)+this.second*(2*Math.PI/3600)); double minuteY = centerY-mLength*Math.cos(this.minute*(2*Math.PI/60)+this.second*(2*Math.PI/3600)); Line mLine = new Line(centerX,centerY,minuteX,minuteY); mLine.setStroke(Color.GREEN); mLine.setStrokeWidth(4); //Draw the hour hand double hLength = clockRadius*0.6; double hourX = centerX+hLength*Math.sin(this.hour*(2*Math.PI/12)+this.minute*(2*Math.PI/(60*12))+this.second*(2*Math.PI/(3600*12))); double hourY = centerY-hLength*Math.cos(this.hour*(2*Math.PI/12)+this.minute*(2*Math.PI/(60*12))+this.second*(2*Math.PI/(3600*12))); Line hLine = new Line(centerX,centerY,hourX,hourY); hLine.setStroke(Color.GREEN); hLine.setStrokeWidth(4); //add the node to the pane object getChildren().clear(); getChildren().addAll(circle,t1,t2,t3,t4,sLine,mLine,hLine,circle2); // Display more details on the clock } public void setHeight(double height) { super.setHeight(height); paintClock(); } public void setWidth(double width) { super.setWidth(width); paintClock(); } }

,

CSCI 428 – Fall 2021 Final Project

100 points + 10 bonus points

Note: This is an individual assignment. Each student MUST complete the work on his/her own. Any code sharing/plagiarism is not tolerated.

Overview

This project consists of two tasks. The goal is to explore how to design various class through encap- sulation, 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

Account.java

SavingAccount.java

CheckingAccount.java

Task1XX.java

Task2

task2aXX.java

task2bXX.java

task2cXX.java

ClockPaneXX.java

README.txt

What to Submit

1. One doc file “CSCI428-project-XX.doc” including 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.

– For task 1, there are 4 java files (including Account.java, SavingaAccount.java, CheckingAc- count.java, and Task1XX.java).

– For task 2, there is just 4 java files including task2a-cXX.java and ClockPane.java.

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): (Bank Account Application) Using classes, design an account list to keep track of different kinds of accounts with the data fields like id, balance, interest rate, and dateCreated. Your program should create a list using ArrayList and maintain the elements in the list.

(a) Design a class named class Account that contains the private data fields id, balance, an- nualInterestRate, and dateCreated that stores the date when the account was created. It also need to contain a default constructor that creates a default account, a constructor that creates an account with the specified id and initial balance, the accessor and mutator methods for id, balance, and annualInterestRate, the accessor method for dateCreated, a method named getMonthlyInterestRate() that returns the monthly interest rate, a method named getMonth- lyInterest() that returns the monthly interest, a method named withdraw that withdraws a specified amount from the account, and a method named deposit that deposits a specified amount to the account.

(b) Create two subclasses for CheckingAccount and SavingAccount accounts. The checking account has no interest, a small number of free transactions per month, and additional trans- actions would be changed a small fee. The saving account should have an annual interest rate 5%. A Checking account has an overdraft limit, but a Savings account cannot be overdrawn.

(c) Write a test program Task1XX.java that creates an Account object with an account ID of 5589, a balance of $35,000, and an annual interest rate of 3.5%. Use the withdraw method to withdraw $3,700, use the deposit method to deposit $6,000, and print the balance, the monthly interest, and the date when this account was created. In this test program, create two more objects of savingsAccount, and checkingAccount with their toString() methods that describe all instance fields. XX should be replaced with your first name and last name. Note the class Task1XX is not finished in a good shape and you are suggested to add more statements if needed.

(d) In the test program, create a ArrayList, add all objects to the list, and use a loop to display all the instance fields in the list by invoking the object’s toString() method.

Grading Rubric

– 5 points for each class (e.g. Account, CheckingAccount, and SavingAccount) with the function toString().

– 5 points for using the Keyword super in the classes Checking and Saving in order to access superclass members in the class Account.

– 5 points for meeting all requirements.

– 10 points for the test program.

Task 2 (50 points): Write three GUI programs using JavaFX to finish the following sub-tasks:

(a) Write a JavaFX program Task2aXX.java that generates three random points on a circle centered at (0, 0) with radius 40 and display three angles in triangle formed by these three points, as shown in Figure 1(a) and (b). (Hint: Generate a random angle α in radians between 0 and 2π, as shown in Figure 1 and the point determined by this angle is (r∗cos(α),r∗sin(α)).) (b) Draw a detailed clock: Modify the ClockPane class provided to draw the clock with more details on the hours and minutes, as shown in Figure 2. Save the java file as Task2bXX.java.

(c) Displays two clocks. The hour, minute, and second values are 10, 30, 55 for the first clock and 13, 23, 56 for the second clock. One example is as shown in Figure 2. Save the java file as Task2cXX.java.

Figure 1: (a) A triangle is formed from three random points on the circle. (b)A random point on the circle can be generated using a random angle α.

Figure 2: A detailed clock Figure 3: Two clocks

The figures below show example GUI of this program for subtasks 1-3.

If time allows, you can also create animation for a running clock for 10 bonus points.

Grading Rubric

– (10 points) for classes with necessary functions and key details

– (10 points) for the workable classes and functions without any syntax or runtime errors.

– (10 points) for appropriate comments

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.

2. You should install the IntelliJIDEA to facilitate the development of Task 2.

—————x———— Good Luck ————x————–

Our website has a team of professional writers who can help you write any of your homework. They will write your papers from scratch. We also have a team of editors just to make sure all papers are of HIGH QUALITY & PLAGIARISM FREE. To make an Order you only need to click Ask A Question and we will direct you to our Order Page at WriteDemy. Then fill Our Order Form with all your assignment instructions. Select your deadline and pay for your paper. You will get it few hours before your set deadline.

Fill in all the assignment paper details that are required in the order form with the standard information being the page count, deadline, academic level and type of paper. It is advisable to have this information at hand so that you can quickly fill in the necessary information needed in the form for the essay writer to be immediately assigned to your writing project. Make payment for the custom essay order to enable us to assign a suitable writer to your order. Payments are made through Paypal on a secured billing page. Finally, sit back and relax.

Do you need an answer to this or any other questions?