You are on page 1of 5

ANNA UNIVERSITY: CHENNAI-600 025 B.E/B.TECH DEGREE EXAMINATIONS, OCT/NOV. 2013 Regulations -2008 Fifth Semester B.

TECH INFORMATION TECHNOLOGY IT2305 JAVA PROGRAMMING LAB Maximum Marks:100

Time: 3 Hours

1. a)Create a java program that calculates the average, grade and display the result of the student. You have assigned a sketch of business requirements to develop a college record-keeping program that has records for students and faculty. There is a natural hierarchy for grouping these record types. They are all records of generic class People, which consists of two subclasses Students and Employees. Students divide into two smaller subclasses: undergraduate Students and Post graduate students. In future these subclasses my further subdivide into still smaller subclasses. (60) b) Write a Java program that determines the number of days in a month. (40)

2. a)To write a java program that reads a string from inputs containing first name, last name and computes an e-mail address with first 3 letters of the first name, first 4 letters of last name, . separator and domain. Display the outputs by invoking objects. (50) b)Create a java abstract class to implement stack concept. Check for the overflow and empty conditions. (50)

3. a)To write a java program for implementing the file handling process. Create a program should let the user to copy first line of one file into another with the following options. (50) a) Create a New File b) Append to a file c) Overwrite in a file b)Write a Java program to display text with 3 different colors and styles. (50)

4. a)To write a Java program which implements multiple classes related with inheritance. The program should have a main class Product, subclasses Book and CD. Also create a sub-class for Book called Scientific. All the Subclass should inherit the properties of the main class and it can have its own properties also. Observe the inheritance hierarchy output and display. (50) b) Write a program called Sort.java that takes three command line arguments and then print them out in alphabetical order (number comes before String). (50)

5. a)To write a Java program to implement the AWT controls and layouts for Student Course Registration form. The program should effectively implement the controls, layouts and handle the events. (60) b) Write a Java program to extract a portion of a character string and print the extracted string(extract m characters starting with nth character). (40)

6. a)To write a Java program that implements run-time polymorphism for product information. Calculate the total sales price for each product. The sales price should be calculated differently depending on the product type. Overriding method of object instance of the sub-class should be invoked. (50) b)Write a Java program that employs several file I/O techniques. Give the user a choice of file operations: create the file, update the file or display the file. (50)

7. a)To write a java program to implement single interface multiple implementation. Create an interface with an interface method that represents the salary calculation of employee. Create two classes that implement the interface. The two classes should have their own method plus the interface method and should have different implementations for the interface method to calculate the salary of employee. Observe the following. (50) i) Create a run-time exception and handle them in your code. ii) Create your own exception to maintain the credit limit of the customer. The program should throw an exception whenever the user tries to withdraw amount greater than the credit limit specified in exception. b) Write a Java program to encrypt a message entered by the user. (50)

8.

a)Write a java program that creates clock object , sets hours, minutes and seconds. Write a method tick that add 1 second to minute and wraps around at 60 seconds, similarly minutes wrap around at 60 minutes and hours wraps around at 24 hours to 0. Add a method which returns the time as a 12-hour time, labeled with a.m or p.m. (50) b) Write a Java program to display a happy face in a graphics context. (50)

9. a)Write a Java program to display any of the five different shapes in a graphics context according to the user choice. (50) b) Write a Java program to simulate a fair coin flip and print out heads and tails accordingly. (50)

10. a)Write a java application for a university course offering. There are to be classes for textbook (isbn, title & author), instructor(firstName,lastName,department and email), and course( coursetitle, variables for textbook and instructor classes). This application should also have a driver class to test the other classes constructed and should offer the user choices to produce a course report. (50) b) Write a Java program to display a cone in a graphics context. (50)

11. a)Write a program called Sort.java that takes three command line arguments and then print them out in alphabetical order (number comes before String). (50) b)Write a java code that creates the button , label (to display greeting) and listener class for a button that displays one of 10 randomly selected greetings. (50)

12. a) Write a program to find the relations of a person. Define a class Person that contains parents_name ,Name of the person, sex, age, array containing list of hobbies and parents name. Write a FindMother, FindFather, FindUncle, FindCousin and FindAunty that returns the object of the person class. (50) b)Write a java code that creates the button to control traffic by displaying the traffic signal colors on the label. respective (50)

13. a)Write a java program to implement stack using linked list. Write a method to push and pop data of the stack. (50) b) Write a Java program to demonstrate that as a high-priority thread executes, it will delay the execution of all lower-priority threads. (50)

14. a)Write a java program to check whether the given string is palindrome or not using Stack class. (50) b)Write a Java program add a new ball each time the user clicks the mouse. Provide for a minimum of 10 balls. Randomly choose the color for each new ball. (50)

15. a)Write a java program to check whether the given string is palindrome or not using Queue class. (50) b) Write a java program to simulate server-client communication using threads. (50)

16. a)Write a java program to simulate the legendary race of the tortoise and the hare by placing each of the animals in separate threads. At the start of the race call the start methods for each of the threads. Use wait, notify and notifyAll to synchronize the animals' activities. (50) b) Write a customer class to hold and display customer details. Validate the email-id(i.e @ symbol) and phone number(i.e 10 digits) of customers through exception handling mechanism. (50)

17. a)Write a program to write all the data of an array of objects to a file. Read the same from the file and display it on the screen (50) b)Write a program to remove trailing spaces in a string. (50)

18. Create a Bank class, an object of which contains an array of Account objects derived classes called SavingsAccount and CurrentAccount. The Bank class requires methods for opening and closing accounts, and for paying a dividend into each account. A SavingsAccount object, in addition to the attributes of an Account object, should have a method which adds interest to the account. CurrentAccount object should have an overdraft limit variable. Ensure that you have overridden methods of the Account class as necessary in both derived classes. Create some test accounts of each type. Write an update method in the bank class. It iterates through each account such that Savings accounts get interest added and CurrentAccounts get a letter sent if they are in overdraft. (100)

You might also like