In: Computer Science
create class diagram of the following case.
Case: Once a month, the person in charge of the human
resources area of the organization prepares
the payroll to be paid. Once the calculation is made, the manager
accesses and authorizes the payment of the
information generated for payment, which is updated in the database
to be sent to the
Bank.
The person in charge of the payroll, in turn, is in charge of
making the entry and / or withdrawal of the
collaborators of the organization.
Employees can access the intranet to consult the remuneration they
will receive.
Regarding the system, it is required to develop the modeling of
objects and interfaces with the use
of object structures and their relationships for an organization
that has as collaborators
to the following categories:
- Administrative
- Sellers
- Production workers
Administrative staff have a fixed monthly salary
Production workers must work three different shifts: Morning,
Afternoon, and Night
and eventually accrue for overtime. Depending on the shift in which
they work, the salary varies.
Sellers earn a base salary plus sales commissions. Has a zone
assigned
or region in which you are responsible for the distribution of the
company's products.
The minimum attributes to consider are: ID, names, surnames, date
of birth, level
educational.
I believe you are learning OOPS concepts , that is pretty good.AS OOPS designing is one of the most sought afters kills in the industry.
Its nice that you are designing the classes,as it will help you become better software developer.
My industrial experience says, before designing the classes you check the relationships between the classes.
SO here as we can check, Employees are of three types ,Shifts are of three types.
NOTE : ITS a golden rules i am telling you, always prefer interfaces over classes, that means, Implementing interface is better than extending classes.
So first create an interface Employee
interface Employee {
private ID,
Name,
surname,
DOB,
Education
void Salary();
}
// here salary is made abstract as different employees have different salary structure
make next interface SHIFTS
interface Shifts {
void remenuration ();
}
// various shifts will have different payouts
Now make some classes,
Class Adminitrative_Worker implement Employee {
// initialise all the attributes here name, DOB etc.
void salary () {
// overridden function
return fixed salary;
}
}
class Sellers implement Employee {
float commssion
Seller(comission) {
// each seller will have different commission thus , intialize it in the parametrized constructor
}
void salary () {
// here you add fixed salary + sales commission
}
}
class Production_Workers implement Shifts, Employee {
string shift;
Production_worker(shift){
//each worker will have different shift intitliase it here
}
void remenuration(){
if day return day_payout
else if evening return evening_payout
else return night_payout
}
void Salary(){
return fixed + remuneration()
}
}
NOTE : here each class has been identified with respect to constarints provided above , there can be many designs to follow up, but this one is good enough to work even on LIVE Project.
also, i would suggest you to go through, design pattern in OOPS concepts, it help you a lot.
HOPE YOU LIKED IT.
HAPPY LEARNING !