0% found this document useful (0 votes)
3 views

CSCI300 - Assignment 1

The document outlines an assignment for CSCI 300, requiring students to implement an Account class based on provided UML specifications. Key tasks include creating a constructor that initializes account attributes, ensuring positive balances, generating random passwords, and implementing methods for login verification and string representation. Additionally, students must write a driver class to manage multiple accounts and perform specific operations, with the assignment due on March 23rd.

Uploaded by

shehabhasan393
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

CSCI300 - Assignment 1

The document outlines an assignment for CSCI 300, requiring students to implement an Account class based on provided UML specifications. Key tasks include creating a constructor that initializes account attributes, ensuring positive balances, generating random passwords, and implementing methods for login verification and string representation. Additionally, students must write a driver class to manage multiple accounts and perform specific operations, with the assignment due on March 23rd.

Uploaded by

shehabhasan393
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Department of Computer Science and Information Technology

CSCI 300 – Intermediate Programming With Objects


Assignment 1

Consider the below UML for an Account class:

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:

1. Creates an array that can hold 4 accounts.


2. Fill the array with 4 accounts of your choice.
3. Print the information of all accounts with balance above 1000.
4. Prompt the user to enter an id and password and then checks if they match the id and password
of the second account in the array.

Assignment Guidelines:

 This assignment is due on Sunday March 23rd by midnight.

 This assignment covers chapter 8 and 9.

 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

You might also like