Categories
Writers Solution

Manager and Worker classes will add the fields necessary to implement their

interrelationships

For this task you will create a number of classes that provide information about the personnel in an organisation. You will write a Manager class and a Worker class, each of which will subclass a Person class. A Person will have a name, just a String, and an identity number, which is an integer. As no-one is just a person, the constructor of the Person class will only be used by constructors of derived classes. The name will be provided when an instance of a derived class is created. The identity should be automatically generated during construction and must be unique. No person, either manager or worker, can have the same identity number as another person. You should also ensure that the identity numbers of managers and workers cover separate ranges of integers (e.g. 1 – 99 for managers and 100 – 999 for workers), so that an identity number can be used, in the human organisation but not in your program, to discern whether a person is a manager or a worker.

There is a relationship between managers and workers that needs to be incorporated in the

corresponding classes. Each manager is the leader of a team of workers. In particular, a manager leads

exactly one team and a worker belongs to exactly one team. The system must allow for workers to be

moved from one team to another, managers to be moved from leadership of one team to leadership of

another, as well as for the appointment and retirement of personnel. For the current assignment task a

simplifying assumption will be that we do not need a class to represent a team’s work area. Instead the

manager-worker relationships will be incorporated by each Manager object maintaining a list of

Worker references, representing the team, and each Worker object maintaining a Manager reference,

representing the team leader.

The following state and functionality should be provided for these classes:

  • The Person class will maintain name and      identity fields, as described above, and the derived

Manager and Worker classes will add the fields necessary to implement their

interrelationships.

  • Appropriate constructors will allow the name      and identity fields of Manager and Worker

objects to be initialised properly. Note that, although the identity field will be inherited,

its initialisation depends on the particular derived class. Full initialisation of the fields

implementing manager-worker interrelationships would not be done at this stage, but they

must be in an appropriate state for testing.

  • Getters for fields will be provided in      appropriate classes.
  • Appropriate toString methods will be      provided as required to simplify the display of object

state. Where an object’s state contains a reference to a person, include that person’s identity

number in the string.

  • For setting up, changing, or nullifying the      field values implementing manager-worker

interrelationships you need to make changes in the state of both a Manager object and a

Worker object. There are different ways to do this. For example, for moving a worker

between teams, one way is to provide the Worker class with a movetoTeamOf instance

method that accepts a Manager reference. The code of this method could first make some

checks (e.g. are either of the current and new Manager references null or are they the same?)

before removing the current worker from the team of the current manager, changing the

worker’s manager and then moving the worker to the new manager’s team. Note that this

would access instance methods of Manager for removing a worker from a team and for

adding a worker to a team. A similar approach applies for setting up a new worker and for

removing a worker from the system; the changes must be done so as to ensure the

information system remains in a stable state, which cannot be left as a responsibility of client

code.

  • Changing team managers is another operation on      manager-worker interrelationships that

needs to be done, and with care. It might be implemented via a switchTeams instance method

of the Manager class that accepts the reference of another manager, but you need to make

sure that this switches all the Manager references held by the respective teams. You also

need to implement functionality for removing a manager from the system, which will only

occur if a newly created manager is available as a replacement, and adding an additional

manager, whose team could then be populated by client code applying some combination of

creating new workers and moving workers using functionality described above.

Write a TestPersonnel class to test the functionality of the classes you have developed. It will be done

without user interaction and will provide the following sequence of actions, using good design techniques such as in the appropriate use of methods:

  • Create a single list for the people in the      organisation, which is a list containing Person

references for managers and workers.

  • Provide code to create some managers (3 will      do) and some workers (12 will do) and add

them to the list. Assign the workers in turn to the different managers.

  • Display the state of all the people in the      organisation.
  • Add 3 new workers to the organisation,      assigning them in turn to the different managers.
  • Display the state of all the people in the      organisation.
  • Remove from the organisation the first 2      workers in the list of people.
  • Display the state of all the people in the      organisation.
  • Add a new manager to the organisation,      reassigning the first worker in the list of people to

this new manager.

  • Display the state of all the people in the      organisation

GET THE COMPLETED ASSIGNMENT

ASSIGNMENT COMPLETED AT CapitalEssayWriting.com

MAKE YOUR ORDER AND GET THE COMPLETED ORDER

CLICK HERE TO ORDER THIS PAPER AT CapitalEssayWriting.com on

Manager and Worker classes will add the fields necessary to implement their

interrelationships

NO PLAGIARISM, Get impressive Grades in Your Academic Work

Categories
Writers Solution

Create classes with some of the functionality of a bank account

2. Create classes with some of the functionality of a bank account. A single account may have (2) one or more joint owners, but one customer can be the owner of only one bank account (for now). Each of the following should be represented by a class that can have data and functions: • Customer class • Account class 3. • Customer should have the following attributes: Account, Full Name, Work Phone, Home (4) Phone, Cell Phone, Address Line 1, Address Line 2, City, Province, Postal Code. • Customer should always have a full name and also has a default empty string for all of the string values. • Customer should have member functions to set/get all of the data members. • Add validation code to ensure the following: – It is optional for a customer to have an account – A customer must have a full name of at least 1 character in length – One of the phone numbers must be set (any one), and additional phone numbers are optional – Address Line 2 can be blank, but the other address lines can not be blank For each of the above items, write a human readable error message to standard error when validation prevents an action from succeeding. For setter functions, return true if the operation succeeded, and return false if the operation failed. 4. • Account should have the following data members: Account Number, status (can only be (3) one of open, closed, frozen), date opened, branch number, subaccounts • Account should have a constructor that sets reasonable defaults for all of the data members. • Account should have member functions to set/get all of the data members where it makes sense to set the value (add inline comments explaining any decisions to omit get/set functions). In the case of subaccounts add member functions to add and/or remove one subaccount at a time. • Add validation code to ensure the following: – The constructor always requires an account number and a Customer – A newly created account is automatically an open account – An open account can be closed or frozen. A closed account can not be opened or frozen. A frozen account can return to open state and it also can be closed without returning to open state first. – Account balance can be both negative or positive, and must be stored as an integer representing a number of pennies (cents) rather than dollars. – Account deposits and withdrawals must be done using number of pennies (cents) rather than dollars. – Deposits and withdrawals must be positive numbers. – Ensure that the balance can never fall outside of the range of a 32 bit signed integer, but permit as much of this range as possible, including negative values. For each of the above items, write a human readable error message to standard error when validation prevents an action from succeeding. For setter functions, return true if the operation succeeded, and return false if the operation failed. 5. Write a test suite for the above functionality. Use the test suite to verify that your classes are (6) implemented correctly. Ensure that I have access to your git repostory. Please post the path of your git repository to the assignment drop box

WE HAVE DONE THIS ASSIGNMENT BEFORE, WE CAN ALSO DO IT FOR YOU

GET SOLUTION FOR THIS ASSIGNMENT, Get Impressive Scores in Your Class

CLICK HERE TO MAKE YOUR ORDER on Create classes with some of the functionality of a bank account

Are You looking for Assignment and Homework Writing help? We Provide High-Quality Academic Papers at Affordable Rates. No Plagiarism.

TO BE RE-WRITTEN FROM THE SCRATCH