Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Java Programs

807607Oct 25 2006 — edited Oct 25 2006
Hi All,

I have an open Book Exam on Java, OOPS Concepts .... I need some programs basically which covers most of the Core Java programming.

Can any one guide me for this ...

I have following topics

Defining classes and methods, Objects and object references, Packages, Exception handling, Strings
Reading Input, Array Lists and Linked Lists, Arrays, Static Fields and methods, Programming Style
From Problem to code, Identifying classes and methods, Relationship between classes, Use Cases
CRC Cards, UML class, sequence and state diagrams, Using javadoc for designing Documentation
Designing and implementing the interface of a class, The importance of encapsulation, Analyzing the quality of an interface, Programming by Contract, Unit Testing
The Icon Interface Type, Polymorphism, Drawing Shapes, The comparable and Comparator interface types
Anonymous classes, Frames and User Interface Components, User Interface Actions, Timers, Designing an Interface Type
Iterators, The Pattern Concept, The Observer Pattern, Layout Managers and the Strategy Pattern
Components, Containers and the Composite Pattern, Scroll Bars and The Decorator Pattern, How to recognize Patterns, Putting Patterns to Work
The Concept of Inheritance, Graphics Programming with Inheritance, Abstract classes, The Template Method Pattern
Protected Interfaces, The Hierarchy of Swing Components, Standard Geometric Shapes and Exception classes, When not to use Inheritance
The Java Type System, Type Inquiry, The Object class, Shallow and Deep Copy
Serialization, Reflection, JavaBeans Components
Frameworks, Applets as a simple Framework, The collection Framework, A Graph Editor Framework
Thread Basics, Thread Synchronization, Animations
More Design Patterns: The Adapter Pattern, Actions and the Command Pattern, The Factory Method Pattern, The Proxy Pattern


I get questions like

Q 1. A multinational software industry, say Moon Microsystems publishes manuals and academic books. Manuals will not contain figures where as the books will have figures. The industry appoints an editor to manage these activities. The editor will maintain an ArrayList, to store these titles of books and manuals. Upon request from the management board, the editor prints required titles of books and manuals. The Editor will calculate the cost of expenditure for the printing of each individual title. The cost to print a book is computed as follows: First find the cost to print each word and then use it to find the cost for each sentence, subsection and then followed by the sections and chapters. Then the cost is also computed based on the number of figures that each sub-section contains, so that it can be used to find the cost for printing one section, chapter and so forth. The total of these two costs will yield the total cost to print a book. The procedure to compute the cost to print a manual is same as that of a book, but since the manuals do not have the figures, the computation of cost to print the figures is not necessary. The management board contacts the Editor for relevant information and Editor passes the information to the board so that the board can take a decision to fix the selling price of the each individual title.
List out all the potential patterns in this application. Give proper justification to support the intent of your design pattern choices. Design a neat UML class diagram that reflects your patterns, so that implementation can easily be derived from the diagrams; Provide an efficient JAVA implementation that reflects the patterns that you have identified for the above application. Write a Test/Driver class by assuming that the management asks the editor to print the following titles of books and manuals:
Books:
(1) MoonJava 1st edition (2) MoonC, 2nd Edtion (3)UML@Moon 3rd Edition
Manuals:
(1) MoonRationalRose (2) MoonJavaDoc (3) MoonEJB [2 + 2 + 6 + 15 = 25]
Q 2. Implement a class Logger that has a graphical application which can be used to log messages to a frame containing a JtextArea. Supply a static method getInstance that yields the instance of Logger and a method log that adds a string to the text area. Use singleton pattern to ensure that only one instance of the Logger class is created. (7)
Q3 (a). What Java code do you use to test
(i) Whether x belongs to the Rectangle class ?
(ii) Whether x belongs to a subclass of the JPanel class (but not the Jpanel class itself)?
(iii) Whether the class of x implements the Cloneable interface type ? (3*2 = 6)
(b). In Java, a method call on an object such as x.f() is resolved when the program executed, not when it is compiled, in order to support polymorphism. Name two situations where the Java compiler can determine the exact method to be called before the program executes. (2)
BITS ZC411 (EC-2 REGULAR) FIRST SEMESTER 2005-2006 PAGE 2
Q 4. You have to create a frame window as shown in the following figure. This figure shows a frame with five buttons labeled �Left�, �Right�, �Scale up�, �Scale Down� and �Stop�. There are two icons(Circular and Rectangular) shown at the center of the frame window. Both icons have to be filled with red colors.



Left

Right

Scale Up

Scale Down

Stop
When you click the Left Button , both icons should start moving to the left (Both Icons should stop moving when either the left side border of the frame reaches or the stop button is pressed) . When you click on the Right Button, both icons should start moving to the right (Both Icons should stop moving when either the right side border of the frame reaches or the stop button is pressed). When you click on the Scale Up button, both icons should keep on incrementing in size and needs to be repainted after each increment until its dimensions are within the frame bounds. Scale up can also be stopped in between by pressing stop button. When you click on the Scale Down button, both icons should keep on decrementing in size until their size reaches 0. Scale Down action can also be stopped in between by pressing stop button. You have to attach a single thread for all types of actions. Depending upon the button pressed, thread should carry out the respective action.
Note :
1. No action should repaint the icons outside frame boundary.
2. Buttons can be pressed in any order.
3. Assume that increment and decrement values for scaling up and scaling down at each stage is 1.


Thanks and Regards,
Ajay
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 22 2006
Added on Oct 25 2006
1 comment
148 views