TY_BCS_JAVA







1.1 Create abstract class shape. Drive three classes sphere. Cone and cylinder from it. Calculate Area and volume of all ( use method overriding)

2.1 Write a menu driven program to perform the following operations on a set of integers as shown in the following fig. the load operation should generate 10 random integer(2 digit) and display the number on screen. The save operation should save the number to a file”number.txt”. The short menu provides various operations and the result is displayed on the screen.

3.1 Define a class MyDate( Day,Month,year) with method to accept and display a MyDate object. Accept date as dd, mm, yyyy. Throw user defined exception “InvalidDateExeption” if the date is invalid. a. 12 15 2015 b. 31 6 1990 c. 29 2 2015

4.1 Write a menu driven program to perform the following operations on a set of integers as shown in the following figure. A load operation should generate 10 random integers (2 digit) and display the no on screen. The save operation should save the no to a file “number.txt”. The short menu provides various operations and the result is displayed on the screen.

5.1 Define a class saving account (acno, name, balance) .define appropriate and operation withdraw(), deposit(), and viewbalance(). The minimum balance must be 500. Create an object and perform operation. Raise user defined “InsufficientFundException” when balance is not sufficient for withdraw operation.

6.1 Write a program to accept a decimal number in the Textfield. After clicking calculate button, program should display the binary, octal, hexadecimal equivalent for the entered decimal number. 

7.1 Create a package series having two different classes to print the following series. a. Prime number b. Squares of numbers Write a program to generate ‘n’ terms of the above series.

8.1 Write a program to create the following GUI and apply the change to text in the TextField.

9.1 Create an applet which display a message in the center of the screen. The message indicates the events taking place on the applet window. Handle events like mouse click, mouse moves, mouse dragged, mouse pressed. The message should update each time an event occurs. The message should give details of the event such as which mouse button was pressed ( hint: use repaint(), mouselistener, MouseMotionListener)

10.1 Write a program to implement simple arithmetic calculator. Perform appropriate validations.

11.1 write a program to accept a string as command line argument and check whether it is a file or directory. Also perform operations as follows. a. If it is a directory, list the name of text files. Also, display a count showing the number of files in the directory. b. If it is a file display various details of that file.

12.1 Create the following GUI screen using appropriate layout manager. Accept the name, class, hobbies from the user and display the selected options in a text box.

13.1 Write a program to accept a string as command line argument and check whether it is a file or directory. Also perform operation as follows: a. If it is a directory, delete all text file in that directory. Confirm delete operation from user before deleting text file. Also, display a count showing the number of files deleted, if any, from the directory. b. If it is a file display various details of that file.

14.1 Write a menu driven program to perform the following operations on a text file “phone.txt” which contain name and phone number pairs. The menu should have options: a. Search name and display phone number b. Add new name-phone number pair.

15.1 Write a program to read item information( id, name, price, qty) from the file ‘item.dat’. write a menu driven program to perform the following operations using random access file: a. Search for a specific item by name b. Find costliest item c. Display all items and total cost.

16.1 Define a class cricket player(name, no_ofinings, no_of_times_notout, total_runs, bat_avg).create an array of ‘n’ player objects. Calculate the batting average for each player using a static method avg(). Handle appropriate exception while calculating average. Difine static method ‘sortPlayer’ which sorts the array on the basis of average. Display the player details in sorted order.

17.1 Define an abstract class “staff” with members name and address. Define two subclasses off this class- ‘Full Timestaff’ (department, salary) and part time staff (number_of_hours_, rate_per_hour). defineappropriate constructors.create ‘n’ object which could be of either FullTimeStaff or ParttimeStaff class by asking the users choice. Display details of all “FulTimeStaff” objects and all “PartTimeStaff” objects.

18.1 Define a class MyNumber having one private int no member. Write a default constructor to initialize it to 0 and another constructor to initialize it to a value (Use this). Write methods isNegative, isPositive, isZero, isOdd, isEven. Create an object in main.Use command line arguments to pass a value to the object and perform the above tests.

20.1 Write a program to create package “TY” which has a class TYmarks( computer total, maths total, electronics total). Create another package “TY” which has a class TYmarks (Theory, Practical). Create “n” object of student class having roll number, name, SY Marks and TY Marks. Add the Marks of SY and TY computer subject and calculate grade (‘A’ for>=70,’B’ for>=60,’C’ for >=50, “Pass Class” for >=40 else “Fail”) and display the result of the student in proper format.

21.1 Define a student class ( roll number, name, percentage). Define a default and parameterized constructor. keep a count of object created. Create object using parameterized constructor and display the object count after each object is created. ( use static member and method). Also display the content of each object. Modify program to create “n” object of the student class. Accept details for each object. Define static method “shortStudent” which shorts the array on the basis Of percentage.

22.1 Write a menu driven program to perform following operations. Accept operation accept the two number using input dialog box. GCD will compute the GCD of two numbers and display in the message box and power operation will calculate the value of an and display it in message box where “a” and “n” are two inputted values.

23.1 Create an interface”CreditCardInterface” with methods: viewcreditamount(),PayCard(). Create a class “silverCardCustomer”(name, cardnumber)(16 digit), creditamount-initialized to 0, credit limit set to 50,000) which implement above interface. Inherit class GoldCardCustomer from SilverCardCustomer having same method but creditLimit of 1,00,000. Create an object of each class and perform operations. Display appropriate message for success or failure of transaction. ( use method overriding) a.useCard() method increase the credit amount by a specific amount upto creditLimit. b.payCredit() reduces the credit Amount by a specific amount. c. increaseLimit() increase the credit limit for GoldCardCustomer (only 3 times, not mor than 5000 rupees each time.)

24.1 crite a class to create a super class vehicle having members company and price. Drive two different classes LightMotorVehicle(mileage) and heavyMoterVehicle (Capacity_in_tons). Accept the information for ‘n’ vehicle and .display the information in appropriate form while taking data, ask user about the type of vehicle first.

25.1 Define a class employee having members –id, name, department, salary. Define default and parameterized constructors. Create a subclass called manager with private member bonus. Define methods accept and display in both the classes. Create “n” objects of the manager class and display the details of the manager having the maximum total salary (salary+bonus). 

4 comments: