} * } * public class bank account { * * * * Design a class...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
} * } * 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 } * } * 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
Expert Answer:
Answer rating: 100% (QA)
It seems like youve provided a lot of code related to designing classes for managing bank accounts c... View the full answer
Related Book For
Java How To Program Late Objects Version
ISBN: 9780136123712
8th Edition
Authors: Paul Deitel, Deitel & Associates
Posted Date:
Students also viewed these programming questions
-
Please check my code for errors agaisnt the assignment which is long. The parts Dog and rescueAnimals files cannot be changed nor the original given code in the Driver file only can modify where it...
-
This question concerns lexical grammars. (a) Tree Adjoining Grammars contain two types of elementary tree. (i) What are these trees called? [1 mark] (ii) If one were building a grammar for English...
-
Operating Rules. Indicate whether the following statements are true or false. If the statement is false, explain why. a. Since most corporations make distributions only when they are profitable and...
-
Use the same population of {9 cigarettes, 10 cigarettes, 20 cigarettes} from Exercise 45. Show that when samples of size 2 are randomly selected with replacement, the samples have mean absolute...
-
We have assumed that the coefficients in the Taylor rule, ay and an, are both positive. Under this assumption, the rule guides the economy back to long-run equilibrium after a shock. The output gap Y...
-
Cobalt has one stable isotope, \({ }^{59} \mathrm{Co}\). What are the likely decay modes and daughter nuclei for (a) \({ }^{56} \mathrm{Co}\) and (b) \({ }^{62} \mathrm{Co}\) ?
-
As of December 31, 2014, Blue Haven Company had total assets of $100,000, total liabilities of $30,000, and common stock of $50,000. The companys 2014 income statement contained revenue of $16,000...
-
What is the recommended way of handling GST-ITC remittance in the Cash Payments Journal?
-
Consider the following statements regarding the Index of Industrial Production (IIP) : Manufacturing sector has highest weightage in IIP calculation. Base year for current IIP calculations is...
-
What symbolic significance can be attributed to the themes and motifs commonly depicted in classical art, such as mythological narratives, heroic ideals, and representations of divinity, and how did...
-
Caffrey Company budgets $799 of fixed costs, a selling price of $3.95 per unit, and a variable cost of $2.86 per unit. Caffrey budgets selling 1,051 units. What is Caffrey's Margin of Safety Ratio?...
-
Ames C. Scott notes that "Why anyone not impelled by hunger, danger, or coercion would willingly give up hunting and foraging or pastoralism for full-time agriculture is hard to fathom". According to...
-
Discount Jewelry Company sells an anniversary diamond necklace for $ 2 9 0 . The variable cost to make the necklace is $ 1 6 5 . The fixed costs are $ 1 2 , 0 0 0 per month. Discount Jewelry sold 1 ,...
-
Identify whether each item would appear on the income statement, balance sheet, or statement of cash flows. Assets Cash from operating activities Equipment Expenses Liabilities Net decrease (or...
-
Theranos, founded in 2003 when Ms. Holmes was 19, had claimed its Edison devices could test for conditions such as cancer and cholesterol with only a few drops of blood from a finger- prick, rather...
-
The time to assemble the first unit on a production line is 10 hours. The learning rate is 0.94. Approximately how long will it take for the seventh unit to be assembled? The number of hours needed...
-
Dates are printed in several common formats. Two of the more common formats are 04/25/1955 and April 25, 1955 Write an application that reads a date in the first format and prints it in the second...
-
Fill in the blanks in each of the following statements (based on Section 1.5): a) Objects enable the design practice of __________ although they may know how to communicate with one another across...
-
Modify the Contacts app from the preceding exercises to include an image for each Contact. Provide a custom ListView cell factory that displays the Contacts full name and picture with the names in...
-
Go to the PMI Web site and examine the link Membership. What do you discover when you begin navigating among the various chapters and cooperative organizations associated with the PMI? How does this...
-
Go to http://www.pmi.org/business-solutions/casestudies and examine some of the cases included on the Web page. What do they suggest about the challenges of managing projects successfully? The...
-
Using your favorite search engine (Google, Yahoo!, etc.), type in the keywords project and project management. Randomly select three of the links that come up on the screen. Summarize what you find.
Study smarter with the SolutionInn App