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

Web-based client program, Why are JSP pages the preferred API for creating ...

Why are JSP pages the preferred API for creating a web-based client program? Because no plug-ins or security policy files are required on the client systems (applet does). Also,

Javascript to calculate the cost of each book, Write JavaScript code that i...

Write JavaScript code that is executed during form submission to calculate the cost of each book (based on quantity specified) and the overall total cost. The results should be dis

What is preferred organizational structure for organization, What is the pr...

What is the preferred organizational structure for the organization? The Network Organization is becoming the preferred organizational structure.

I need the app to be developed for android, I have a very simple app that I...

I have a very simple app that I have developed and is in the AppStore. I need the app to be developed for Android as it is presently in Objective C only. All plist html/ lists s

How to implementing interfaces in java, How to Implementing Interfaces in j...

How to Implementing Interfaces in java? To actually utilize this interface you create a class that involves a public double calculateTariff() method and declare in which the cl

Program to create 5 objects and get them interact together, In this assignm...

In this assignment, you will create 5 objects and get them to interact together. You will create theatres for which patrons will buy tickets from a box office to watch movies.

Explain java is fully object oriented languages or not, No, java is not ful...

No, java is not fully object oriented language due to it does not support "multiple inheritance" and "pointers" which are used in C++. But, by using Interfaces we can execute multi

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

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

Illustrate an example of static variables, Illustrate an example of static ...

Illustrate an example of static variables System. out .println("some text"); -- out is a static variable JOptionPane. showMessageDialog (null, "some text"); -- showMessageDi

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