Draw out a uml class diagram, JAVA Programming

Assignment Help:

Question:

(a) Draw out a UML class diagram that captures the following information: An Employee is a kind of Person. An ATM is a kind of Machine. Both an Employee and an ATM can behave as if they were a Cashier, in that it is possible to both withdraw cash from them and deposit cash with them.

(b) Now consider the Person class and the Cashier interface listed below. Write the Java code for an implementation of the Employee class of part 1(a). Do not complete the body of any methods in the Employee class - just place comments to outline the actions that should occur:

public class Person {
public int age;
public int secId_number;
}

public interface Cashier {
public void withdraw(int account_id, int amount);
public void deposit(int account_id, int amount);
}

(c) The Java class for Person in part 1(b) does not illustrate best practice in Java programming.

i. Modify the Person class to make it robust so that it is not possible for negative values of the fields of an instance of Person to be set.

ii. Define a constructor for the Person class that enables an instance to be created with specific age and secId_number values.

iii. Define a constructor for the Employee class that also enables specific age and secId_number values to be set.

iv. What is the difference between declaring a field private and declaring it protected?


Related Discussions:- Draw out a uml class diagram

Luminus jewels, Luminous Jewels - The Polishing Game Byteland county is ve...

Luminous Jewels - The Polishing Game Byteland county is very famous for luminous jewels. Luminous jewels are used in making beautiful necklaces. A necklace consists of various lum

Java, Ask question Write an inheritance hierarchy for classes Quadrilateral...

Ask question Write an inheritance hierarchy for classes Quadrilateral, Trapezoid, Parallelogram, Rectangle and Square. Use Quadrilateral as the superclass of the hierarchy. Create

Decoding program, 699906626330444777707776662233777 decoding program

699906626330444777707776662233777 decoding program

A talent agency program , class Writer extends Client {    // additional m...

class Writer extends Client {    // additional members    private boolean technical = false;    private boolean government = false;    private boolean international = false;    pri

How can you describe a consistent web design, How can you describe a consis...

How can you describe a consistent web design? Why is it required? A consistent web design is Easy understandable, not along with heavy graphics, easy navigation. It is required

Posting on a wall, Viewing a User's Wall Where your project allows you t...

Viewing a User's Wall Where your project allows you to view a user's profile, your ZHTML must provide the following capabilities: 1. Provide a Wall for that user profile, dis

What do you understand by private and public class, What do you understand ...

What do you understand by private, protected and public? These are accessibility modifiers. Private is the most restrictive, whereas public is the least restrictive. There is n

What is object oriented programming explain with an example, What is Object...

What is Object Oriented Programming explain with an example? In Java everything is an object or a class (or a piece of one or a collection of various). Objects send messages t

Elaborate vector or object oriented graphics, Elaborate Vector or Object or...

Elaborate Vector or Object oriented graphics along with at least one example. Object Oriented Graphics are the graphics that are commonly oriented towards the objects and have

Design a game in java, The game of Kala is played on a rectangular board: ...

The game of Kala is played on a rectangular board: In front of each player are six pits numbered 1 to 6 (called the 'side pits'). To the right of a player's side pits is a

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd