1
Student Name: __________________
Class and Section __________________
Total Points (20 pts) __________________
Due: August 23, 2010 before the class
Project: The Account Class
CSCI 1302 Advanced Programming Principles
Armstrong Atlantic State University
Problem Description:
(The Account class) Design a class named Account that
contains:
A private int data field named id for the account
(default 0).
A private double data field named balance for the
account (default 0).
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 withdraw that withdraws a specified
amount from the account.
A method named deposit that deposits a specified
amount to the account.
Analysis:
(Describe the problem including input and output in your own words.)
2
Design:
(Draw an UML class diagram for the Account class.)
Coding: (Copy and Paste Source Code here. Format your code using Courier 10pts)
public class Test {
}
Class Account {
// Implement the class here
}
3
Testing: (Describe how you test this program)
Submit the following items:
1. Print this Word file and Submit to me before the class on the due day
2. Compile, Run, and Submit to LiveLab as Exercise08_07 (you must submit the program
regardless whether it complete or incomplete, correct or incorrect)
Solution Code:
public class Test {
public static void main (String[] args) {
public Account(int newId, double newBalance) {
id = newId;
balance = newBalance;
dateCreated = new java.util.Date();
}
5
public double getMonthlyInterest() {
return balance * (annualInterestRate / 1200);
}