CPT121 Task 3.1.3. Practice Exercises -Class basics Solved

30.00 $

Category:

Description

Rate this product

Task 3.1.3 Practice Exercises – Class basics

  1. Given the Account class and the statement

Account temp = new Account(“Tom”, 1000);

Describe how the following tasks maybe be achieved and, for each task, give a code example showing what would need to be done

  • how the Account reference temp can be changed
  • how the Account object itself may be changed

Tip: you may find it helpful to draw a diagram when considering how to approach each of the tasks above.

  1. Suppose we are required to keep track of the telephone number and tax file number for all bank account holders, in addition to name and balance.

What changes will you make to the Account class

  • Instance variables?
  • Constructor
  • Accessors?
  • Mutators?

Note that the telephone number would be supplied hen the account is first opened, but the tax file number may be supplied later and you should take this into account when considering what updates the Account class may require.

  1. write a program which demonstrates how a new Account object will be created (including a telephone number), prints the current details for the Account (including telephone number), updates the tax file number for the Account to value supplied by the user and finally prints current details for the account (including telephone number and tax file number).
  • task_3_1_3-fucfdu.zip