Please help me :(

Hi, im a bigginer in JAVA, and need help please.
How do i solve this, i tried doing part of it but in some questions i didnt.

class Account {

// 1) Make a static private variable called counter of type int and set it to 100000 initially here.
// This class variable will gives ID's to the accounts created in the Bank. 100000 will be
// the id of the first account opened and then 100001 for the second etc...
// Make another static private variable of type double called capital and set it to 0.
// This class variable will contain the sum of all the balances that are created in the bank.
// Make a third static instance variable of type int called numAccounts and set it to 0.
// This will contain the number of accounts that have been opened in the bank.
private static int counter = 100000;
private static double capital = 0;
private static int numAccounts = 0;

// 2) Make 3 private instance variables called owner of type Person ,
// balance of type double and accountID of type int. (You will use the counter
// class variable to set the accountID in the constructor.)
private Person owner;
private double balance;
private int accountID;

// 3) Make a constructor that takes 2 arguments a Person and a balance and
// update the static variables correctly (also avoid any privacy leaks). If
// the balance is negative set it to zero. Set the accountID.




// 4) Make a constructor that takes only a Person (you can set the balance to zero)
// Also avoid any privacy leaks. Update the static variables. Set the accountID.


// 5) Make the public methods withdraw and deposit that update the balance and the
// capital variables properly. If the amounts are positive your method should return
// true after updating the variables otherwise do not update anything and return false.



// 6) Make two static accessor methods to return the capital and numAccounts variables


// 7) Make an accessor method to return the owner (avoid privacy leaks)
public Person getOwner(){
return owner;
}

// 8) Make an accessor method to return the balance
public double getBalance(){
return balance;
}

// 9) Make an equals method to compare two Accounts they are equal if both the
// balances are the same and the persons' dob's are the same



// 10) Make a toString method that prints out the following info:
//
// Person Info:
// ============
// John , 1350.5 , 12/4/1987
// Balance: 14540
// AccountID: 100002

public string toString(){
return "Person Info:
============
" + Person +
"
Balance: " + balance +
"
AccountID: " + accountID;
}








}




Comments

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion