CSCI300 - Assignment 1
CSCI300 - Assignment 1
Write the code for the above class; taking into consideration the below:
Id: is set as 101 for the first created account, 102 for the second account and so on. It must be
automatically set using the class constructor. Hint: use the static count attribute to set the
account id.
name: is the name of the account owner.
password: is the password for the account owner.
balance: is the account balance in usd.
Count: a static attribute that is incremented by 1, each time a new account is created.
The constructor takes as parameters a name and balance. It then sets the password by calling
the generatePassord method (see below) and the id as explained above. Reminder: the id is
automatically generated for each account. Make sure that the balance is positive value.
setBalance should change the balance and make sure that it is a positive value.
generatePassword is a private method that generates a random password. The password should
consist of 8 characters and include at least 1 number. The password should not start with a
number. Ex: ss5rttab
checkLogin: takes an id and password and checks if they match the id and password stored in the
account. The method returns true if they match and false otherwise.
The toString method will return all information about the account with the exception of the
password.
Page 1 of 2
Write a driver class called AccountDriver that performs the following:
Assignment Guidelines:
Assignments (the .java files) should be posted to Google Classroom. Do not post
documents/text files with the .docx or .txt extension.
Make sure that you use meaningful names, documentation (comments), and indentation.
The code (program) should contain in the documentation (comments) your name.
Page 2 of 2