Java Programming
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————–