Question
Part I Build a Customer Business Object . This class will have 6 properties, CustId, CustPassword, CustFirstName, CustLastName, CustAddress and CustEmail. Build an empty args
Part I Build a Customer Business Object. This class will have 6 properties, CustId, CustPassword, CustFirstName, CustLastName, CustAddress and CustEmail. Build an empty args Constructor in the Customer class that initializes all properties to 0 or . Also build a constructor that takes all 6 args and set the appropriate properties. Then build the following 3 methods:
selectDB(custID); //to find a customers info in the DB
insertDB(custId, custPassword, custFirstName, custLastName, custAddress, custEmail) // to insert a new Customer in the DB
deleteDB(); //this method will delete the Customer from the DB
//so to check login execute the following code
Customer c1 = new Customer(); //creates empty object
c1.selectDB(id); //does the DB lookup to find Customer
String pwdb = c1.getPassword();
if (pw.equals(pwdb)) { //this compares pw(from gui to the
//password from the database
//login correct
}
else {
//login incorrect
}
Now we are going to add to our Account Business Class . We need to add 2 methods:
deposit(amt); // adds the amt to the balance in the object and
// also updates the balance in the DB
withdraw(amt); //same as deposit above, except subtract
Account a1 = new Account();
//so to find an account in the database, call selectDB().
a1.selectDB(3001);
// so now to make a deposit we simply
a1.deposit(300.00);
// this method will display the new account balance
a1.display();
Part II Now build an AccountList Business Class. This class will have a list of Account Objects. You can use an Array or an ArrayList to store this list. I would also have a count property to keep track of how many Accounts are in the list. Methods should include a display() method, and an add(Account a1) method.
Part II Now build an Account Business Object. This class will have all of the database access code to lookup an Account in the database. Build a selectDB(acctNo) method in the Account class that accepts an integer acctNo. This method will then go to the database and find all information about the Account requested. Then, in the next lab, when our Servlet wants to find an Account in the DB, all we have to do is
Account a1 = new Account();
a1.selectDB(acctNo);
abalance = a1.getBalance();
Part III Now add a new Property to the Customer class.
AccountList aList;
Make it so that when an User calls the selectDB(3001) method(and passes a custid), the Customer class will go look in the database for all accounts that belong to this customer and put them in the use the aList object. So the Customer class will contain a list of Accounts that the customer owns
It has to be working.Take screenshots.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started