CPT121 Task 3.2.3. Practice Exercises -Implementing program logic Solved

30.00 $ 15.00 $

Category:
Click Category Button to View Your Next Assignment | Homework

You'll get a download link with a: . zip solution files instantly, after Payment

Description

Rate this product

Task 3.2.3 Practice Exercises – Implementing program logic

  1. Redefine the transfer method() of the Account class so that it re-uses the deposit() and withdraw() methods to subtract funds from the source account and add funds to the recipient account.
  2. Suppose we are required to provide an operation that allows us to add interest (given the current interest rate) to all account holders.
    1. What will the signature of the method look like?
    2. Give a possible implementation for that method.
  3. Implement a method to print the details of an Account object to the screen in the following format:

ID:       A123

Name: Bob the Builder  Balance: $1243.87

(all other details should be displayed)

How would you use this method to display the details for an account object from the main program?

  1. Discuss the design for a class to model a simple Person object in your Programming Squad.

You will need to consider the following details in your discussion:

  1. What information is common to all types of people?
  2. How would you create a new person object in another part of the program?
  3. What information might we need to retrieve from a Person object?
  4. What information might we need to change in a Person object?
  5. Consider how might you might update the Person class you have designed so that there is a connection between a Person and the parents of that Person (which are also Person objects), allowing for the names of a Person’s parents to be displayed with the Person’s details.

Discuss how the connection between a given Person and the two Person objects which represent the parents of the Person in question could be set up in the main program.

 

  • task_3_2_3-fuqenw.zip