Question: by java this is FamilyMember.java FamilyMemberTesting.java Exercise 1: (2 points) Project Name : _LABO5_FamilyMember Instruction : Download FamilyMember.java from Google Classroom and complete and a

by java

by java this is FamilyMember.java FamilyMemberTesting.java Exercise 1: (2 points) Project Name

: _LABO5_FamilyMember Instruction : Download FamilyMember.java from Google Classroom and complete and

a FamilyMember class in the following UML. FamilyMember Description familyName="Hilton: String firstName:

String commonFund=100000.00: double privateFund: double The family name The first name of

this is FamilyMember.java

the family member The amount of common fund of the family The

FamilyMemberTesting.java

amount of private fund of the family member FamilyMember (firstName: String, private

Exercise 1: (2 points) Project Name : _LABO5_FamilyMember Instruction : Download FamilyMember.java from Google Classroom and complete and a FamilyMember class in the following UML. FamilyMember Description familyName="Hilton: String firstName: String commonFund=100000.00: double privateFund: double The family name The first name of the family member The amount of common fund of the family The amount of private fund of the family member FamilyMember (firstName: String, private fund: double) A 2-arguments constructor that assigns the input firstname and private Fund to its corresponding properties. printPrivateFund(): void Print out the private Fund of the instance of Family Member in the following format: firstname familyName has SprivateFund 1 Exercise 2: (2 points) Project Name Instruction : _LABO5_FamilyMember : Download FamilyMember Testing.java from Google Classroom and complete a class FamilyMember Testing in the following tasks. a) Use the dot operator in the FamilyMemberTesting class, and print out familyName with commonFund in the following format: The familyName family has $common Fund Your running output should be as below: The Hilton family has $100000.0 b) Create an arrayFamily array to add four members of the Hilton family. Each member is assigned as an object of the FamilyMember class, and their argument values are as below: Order firstName familyName private Fund 1 John Hilton I 254639.12 2 Erika Hilton 187346.56 3 James Hilton 56783.12 4 Paris Hilton 12124.88 c) Use the dot operator to call the printPrivateFund method for printing all family members. Your running output should be as below: John Hilton has $254639.12 Erika Hilton has $187346.56 James Hilton has $56783.12 Paris Hilton has $12124.88 BA Exercise 3: (2 points) Project Name Instruction : LAB05_FamilyMember Update the FamilyMember class in the following tasks. a) Update the FamilyMember class that you created in Exercise 1. Add the two additional methods as below. 1) void contribute ToCommonFund ( double amount) which transfers the input amount from the instance's privateFund to the common Fund 2) static void payFromCommonFund (double amount) which deducts the input amount from the CommonFund. b) Update the FamilyMemberTesting class that you created in Exercise 2, and do in following: 1) The two members in the arrayFamily array use the dot operator to call the contribute ToCommonFund method that Erika Hilton and Paris Hilton can contribute their privateFund $10000 to the commonFund of the family. 2) All members in the arrayFamily array use the dot operator to call the printPrivateFund method for printing their PrivateFund. John Hilton has $254639.12 Erika Hilton has $177346.56 James Hilton has $56783.12 Paris Hilton has $2124.879999999999 c) Update the FamilyMember class that you created in Exercise 1. Add one additional method as below 1) static void printFamilyFund( which prints the input amount from the CommonFund of the family d) Use the dot operator to call the printFamilyFund method for printing the CommonFund of the family in the following format: The familyName family has $ commonFund Your running output should be as below: The Hilton family has $120000.0 From the exercise 1, 2 and 3, the running output of _LAB05_Family Member should be as below: # COMMON FUND OF THE FAMILY The Hilton family has $100000.0 # PRIVATE FUND John Hilton has $254639.12 Erika Hilton has $187346.56 James Hilton has $56783.12 Paris Hilton has $12124.88 # CONTRIBUTION OF PRIVATE FUND John Hilton has $254639.12 Erika Hilton has $177346.56 James Hilton has $56783.12 Paris Hilton has $2124.879999999999 # UPDATED COMMON FUND OF THE FAMILY The Hilton family has $120000.0 Family Member.java X BankAccount2_Testing.java BankAccount.java BankAccount1_Testing.java o Users > pauruetai > Downloads > FamilyMember.java > ... 1 /Exercise 1: Write a FamilyMember class of which its details (2 points) 2 public class FamilyMember { 3 //Exercise 1: add properties go 5 6 //Exercise 1: add constructor 7 8 9 // Exercise 1: add method 10 11 12 //Exercise 3-b: add two additional methods A 13 //Exercise 3-c: print the updated common fund of the family. 14 15 16 17 } 18 1 Users > pauruetai > Downloads > O FamilyMemberTesting.java > public class FamilyMemberTesting { Run | Debug public static void main(String[] args) { 2 3 go 4 familyName with commonFund //Exercise 2-a: use the dot operator to print out System.out.println("# COMMON FUND OF THE FAMILY"); 5 6 //initialize arrays //Exercise 2-b: create an array arrayFamily for adding four members. 7 8 9 10 11 12 13 14 15 16 17 //Exercise 2b: print private fund for all family members. System.out.println("# PRIVATE FUND"); System.out.println("- "); //Exercise 3-b: contribute private fund to common fund System.out.println("# CONTRIBUTION OF PRIVATE FUND"); //Erika //Paris 18 19 20 21 22 23 24 25 26 System.out.println(". "); //Exercise 3-c: print the updated common fund of the family. System.out.println("# UPDATED COMMON FUND OF THE FAMILY"); System.out.println(". "); 27 28 29 30 31 32 } } |

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!