You have been asked to create a scheduling system for a hotel and catering organsiation.You have been given the following information and asked to create a set of classes to represent it.
On the catering side of the organsiation they have Head Chefs Chefs Apprentice Chefs
The system needs to store an employeeid, salary and the holiday entitlement How would you best represent this information in Javae been given the following information and asked to create a set of classes to represent it.
How would you best represent this information in Java
1) Create classes for Head Chef, Chef, Apprentice Chef and store the other values in fields 2) Create an employee class and derive sub classes for Head Chef, Chef, Apprentice Chef and store the other values in fields. 3) Create and employee class with fields for Job title and fields for the other values. 4) Create classes for all of the items mentioned and create a container class to represent employees
3) Create and employee class with fields for Job title and fields for the other values.
These questions can appear tricky as the whole business of designing class structures is more art than science. It is asking you to decide if an item of data is best represented by the "Is a" or "Has a" relationship. Thus in this case any of the job titles mentioned will always refer to something that "Is a" employee. However the employee "has a" job title that might change. One of the important points is to ask yourself when creating a class "Could this change into another class at some point in the future". Thus in this example an apprentice chef would hope one day to turn into a chef and if she is very good will one day be head chef. Few other mock exams seem to have this type of questions but they di come up in the real exam.
Which of the following are valid statements 1) public class MyCalc extends Math 2) Math.max(s); 3) Math.round(9.99,1); 4)Math.mod(4,10);
None of these are valid statements. The Math class is final and cannot be extended. The max method takes two parameters, round only takes one parameter and there is no mod parameter. You may get questions in the exam that have no apparently correct answer. If you are absolutely sure this is the case, do not check any of the options
3) Which of the following are true statements?
1) I/O in Java can only be performed using the Listener classes 2) The RandomAccessFile class allows you to move directly to any point a file. 3) The creation of a named instance of the File class creates a matching file in the underlying operating system only when the close method is called. 4) The characteristics of an instance of the File class such as the directory separator, depend on the current underlying operating system
(Not on the official sub objectives but this topic does come up on the exam)
2) The RandomAccessFile class allows you to move directly to any point a file. 4) The characteristics of an instance of the File class such as the directory separator, depend on the current underlying operating system
The File class can be considered to represent information about a file rather than a real file object. You can create a file in the underlying operating system by passing an instance of a file to a stream such as FileOutputStream. The file will be created when you call the close method of the stream.
Please tell me if such questions can appear. if so i need to prepare for them as well..Also are all questions objective type or are there questions which ask for a written descriptive answer???
Thanks in advance, Radha
[ August 25, 2007: Message edited by: Radhika ] [ August 28, 2007: Message edited by: Radhika ]
Let me tell you a story about a man named Jed. He made this tiny ad:
Programmatically Create PDF Using Free Spire.PDF with Java