Answered step by step
Verified Expert Solution
Question
1 Approved Answer
} * } * public class bank account { * * * * Design a class client, which is a person. first name last
} * } * public class bank account { * * * * Design a class client, which is a person. first name last name * Date of birth balance * Design a class that serves as records of bank accounts. Member variables are interest rate * * Vector of bankAccounts Design a class bank that manages a vector of bank accounts methods to Account number that changes each time an account is created Create a new account and add it to eh vector retrieve an existing account based on SSN retrieve account based on first and last name 1 - 1 - - - 1 */ public class Client { - - * - modify an account with new info, except the account number delete an account based on SSN or first and last name. * Design a class Date that has the following: * int month, day, and year getters and setters for each a constructor that accepts day, month, and year default constructor that sets date to 01/01/2000 constructor that accepts a date as esc address phone number email address last date interest was paid. date of opening the account primary member client (see Client class) Vector of secondary holders up to three secondary holders Methods: getters and setters for balance, interest rate, primary holder,... pay interest that computes the interest to be paid starting at the last date to today. deposit (double m) deposits increase the balance by m withdraw(double m) decreases the balance by m or set to 0 if not enough funds. setPrimaryHolder (Client C) changes primary holder to new Client. SSN (to be able to retrieve account holders). getters and setters for all of them * 5 * extracts day, month, and year from the string. * -toString to display the date in the form mm/dd/yyyy 1 F1 @ 2 6 F2 # 3 20 F3 a string in the form "mm/dd/yyyy" of "yyyy-mm-dd SA 4 F4 CO 65 8 % F5 11 MacBook Air :4. F6 10 6 g 1 F7 119 12 8 } } } 2 return; } month = m; day = d; year = y; public Date (String s) { //constructor that accepts a string in the form of mm/dd/yy or yyyy-mm-dd if(s.contains ("/")) { } } //the formis mm/dd/yyyy split the string at / String[] strSplit s.split("/"); } if(strSplit.length != 3) { 3 } } else { //the formis yyyy-mm-dd split the string at / String[] strSplit s.split(""); if(strSplit.length != 3) { System.out.println("The date is in an invalid format"); this.year = Integer.parseInt(strSplit [2]); this.setMonth (Integer.parseInt(strSplit [0])); //strSplit [0] would be day this.setDay (Integer.parseInt(strSplit [1])); //converts a string into an integer }else if (s. contains ("-")) { = System.out.println("The date is in an invalid format"); 50 public void set Day (int d) { if( this.month == 2 && d > 28 && !isLeap (this.year)) { System.out.println("February does not have that many days"); return; System.out.println("Invalid date"); this.year = Integer.parseInt(strSplit [0]); this.setMonth (Integer.parseInt(strSplit [1])); //strSplit [0] would be day this.setDay (Integer.parseInt(strSplit [2])); //converts a string into an integer return; if(d> days InMonth [this. month] || d < 1) { System.out.println ("invalid day"); this.day = d; public int getMonth() { return month; BO 8 public void setMonth (int m) { if(m < 1 || m > 12) { System.out.println("invalid month") 9 10 MacBook Air } } public void setMonth (int m) { if(m < 1 || m > 12) { } } } public int getYear() { return year; } return; public void setYear (int year) { this.year year; } } this month= System.out.println("invalid month"); esc } = m; //return true if y is leap year and false if not. //A leap year is a year divisible by 4 but not by 100 or divisible by 400 public boolean isLeap (int y) { 0 && y%100 != 0) || (y%400 == 0)) { if((y%4 return true; }else tester public class Tester { = return false; public static void main (String[] args) { public String toString() { String st = this.month + "/" + this.day + "/" + this.year; //"23/03/1999" return st; 3 Date D = D.setYear (2004); D.setMonth (2); ! 1 //create a Date object with default constructor new Date(); D.setDay (29); System.out.println("D: + D); Date D2 = Date D1 = new Date (02, 23, 2001); System.out.println("D1: " + D1); new Date("4/21/1998"); System.out.println("D2: " + D2); Date D3 new Date("1245-10-22"); System.out.println("D3: " + D3); = F1 C 2 5 F2 W # 3 6 20 F3 E $ 4 100 F4 R 8 % 5 F5 9 T O MacBook Air 6 10 F6 & Y 7 F7 12 * CO 8 U F8 X 13 9 1 8 14 F9 0 2 public class Client { |} * Design a class Date that has the following: int month, day, and year getters and setters for each * * * * constructor that accepts a date as a string in the form "mm/dd/yyyy" of "yyyy-mm-dd" * extracts day, month, and year from the string. * -toString to display the date in the form mm/dd/yyyy. * - * a constructor that accepts day, month, and year default constructor that sets date to 01/01/2000 esc January has 31 February is 28 or 29 depending is leap or not leap year is a that is divisible by 4 and not by 100 or they are divisible by 400 1900 is not a leap year but 1600 is a leap year //create an array of constant values that correspond to the number //of days in each month. public class Date { public int getDay() { return day; } static int[] daysInMonth = {0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; private int day, month, year; public Date() { } day = month = 01; year = 2000; public Date(int m, int d, int y) { if (m < 1 || m > 12) { System.out.println("invalid month"); return; 5 return; } //still have to deal the leap year for February //29 is good if leap year if( m == 2 && d > 28 && !isLeap (y)) { System.out.println("Faebruary does not have that many days"); } if (d> daysInMonth [m] || d < 1) { System.out.println("invalid day"); return; 6 } month = m; day = d; year = y; F1 F2 CO 80 F3 F4 F5 10 MacBook Air F6 F7 12 0 2 public void setMonth(int m) { if(m < 1 || m > 12) { } return; System.out.println("invalid month"); } this month = m; public int getYear() { return year; 3 public void set Year (int year) { this.year = year; return false; 5 } tester public class Tester { //return true if y is leap year and false if not. //A leap year is a year divisible by 4 but not by 100 or divisible by 400 public boolean isLeap (int y) { if ((y%4 == 0 && y%100 != 0) || (y%400 return true; }else public static void main(String[] args) { == 0)) { 6 7 I public String toString() { String st= this.month + "/" + this.day + "/" + this.year; //"23/03/1999" return st; //create a Date object with default constructor Date D= new Date(); D. set Year (2004); D.setMonth (2); D.setDay (29); System.out.println("D: " + D); Date D1 = new Date(02, 23, 2001); System.out.println("D1: " + Dl); Date D2 = new Date("4/21/1998"); System.out.println("D2: " + D2); Date D3 new Date("1245-10-22"); System.out.println("D3: " + D3); 8 10 11
Step by Step Solution
★★★★★
3.39 Rating (146 Votes )
There are 3 Steps involved in it
Step: 1
It seems like youve provided a lot of code related to designing classes for managing bank accounts c...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