Sie sind auf Seite 1von 2

Institute of Management, Research and Technology, Nashik – 2

JAVA Assignment (LAB Work)

( MCM-I )

Assin.-1. Write a java program to implement the formula ( area = height X width ) to find
the area of rectangle where height and width are the rectangle’s height and width.
Assin.-2 Write a Java program to initialize numbers and perform all arithmetic operation on them
also display result of all operations.
Assin..-3. Write a program in java to find the result of the following expression.
( Assume a=10 b =5 )
i) ( a <<2) + (b>>2)
ii) (a) || (b>0)
iii) (a + b * 100) / 10
iv) a&b
Assin..-4. Write a program in java to explain the use of break and continue statement.
( for Assign. No. prime number )
Assin..-5. Write a program in java to find the average of marks you obtained in your 10+2
Assin..-6. Write a program in java to find A X B where A is matrix of 3 X 3 and B is matrix
of 3 X 4. Take the values in matrixes A and B from the user.
Assin..-7. Write a program in java to compute the sum of the digits of a given integer.
Remember, you integer should not be less than 5 digits. ( for ex. No. 23451 = 15 )
Assin.-8. Write a java program, which accept String as a command line argument and display it.
Assin.-9. Write a Java program to display the first 10 fibbonacci numbers.
Assin.10. Write a Java program, which accept temperature in Celsius and convert the temperature in
Farehanite. Display both temperatures.
Assin.-11.Write a Java Program, which accepts any three numbers from command Line arguments
and print the largest number form them.
Assin.-12.Write a program which prints the following pattern
a) 1 b) 1 c) *
1 2 2 3 * *
1 2 3 4 5 6 * * *
1 2 3 4 7 8 9 10 * * * *
Assin.-13. Write a Java program, to find the given number is Armstrong number or not Armstrong
number. E.g. 153 = 13+53+33 i.e. summation of cube of each digit is equal to given
Assin.-14.Write a Java program, to sort an array of strings in alphabetical order.
Assin..-15. Write a java program with class rectangle with the data fields width , length and area.
The length and width are double type. The methods are setlength( ) and setwidth( ) and
find area?
Assin.-16. Create a class account with two overloaded constructors. The first constructor is used
for initalizing the name of the account holder, the account number and the initial
amount in the account. The second constructor is used for intialising the name of the
account holder , account number , address, type of account and current balance. The
account class is having methods deposit( ) , withdraw ( ) and getbalance ( ) .
make necessary assumptions for data members and return type of methods.
Create object of account class and use them.
Assin.17-Design a class Maximum, which overloads a methods max, one finds maximum among
two numbers and another finds maximum among three numbers.(Method Overloading)
Assin..-18. Write a program in java to create stack class of variable size with push( ) and pop( )
methods. Create two objects of stack with 10 data items in both. Compare the top
element of both stack and print the comparison result.
Assin..-19. Write a java program to show that private member of a super class can’t be accessed
from derived classes.
Assin..19. Write a program in java to create a player class. Inherit the classes cricket player,
football player and hockey player from the player class. Write two method add ( ) and
print ( ) to assign and display the values for attributes of class.
Assin..20. Write a class worker and derive classes daily worker and salaried worker from it.
Every worker has name and a salary rate. Write method comPay(int hours)
to compute the week pay of every worker.A Daily Worker is paid on the basis of the
number of days s/he works.The Salaried Worker gets paid the wage for 40 hours a
week no matter.What the actual hours are.Test this program to calculate the pay of
workers.You are expected to use the concept of polymorphism to write this program.
Assin.. 21. Consider the trunk calls of a telephone exchange. A trunk call can be ordinary,urgent
or lightning .The charge depend on the duration and the type of the call .Write a
program using the concept of polymorphism in java to calculate the charges.
Assin 22. Write a program to make a package Balance in which has Account class with
Display_ Balance method in it .Import Balance package in another program to access
Display_Balance method of Account class.
Assin 23. Write a program in Java to show the usefulness of Interfaces as a place to keep
constant value of the program.
Assin.24.Design a package to contain the class student and another package to contain the interface
sport. Write the java program using these packages.
Assin.-25.Write a Java program, on multiple inheritance.
Assin.-26.. Create an Interface having two methods division and modules.Create a class ,which
overrides these methods.
Assin.-27. Write a program in Java which implements interface Student which has two methods
Display_grade and Attendance for PG_Students and UG_Students( PG_Students and
UG_Students are two different classes for Post Graduate and Under Graduate Students
Assin.-28. Create an exception class,which throws an exception if operand is non numeric in
calculating modules.(Use command line arguments)
Assin.-.29. Write a Java program to create five threads with different priorites.Send two threads of
the higest priority to sleep state.check the aliveness of the threads and mark which
thread is long lasting.
Assin.-30. Write a program to launch 10 threads .Each threads increments a counter variable.Run
the program with synchronization.
Assin.-31. Write a program for genrating 2 threads,one for printing even numbers and the other
for printing odd numbers.
Assin.-32. Write a program in java to create a String object.Initialize this object with your name
. Find the length of your name using the appropriate String method.Find whether the
character ‘a’ is in your name or not;if yes find the number of times ‘a’ appears in your
name.Print locations occurrences of ‘a’ .Try the same for different String objects.
Assin.-33. Write a program in Java for String handling which performs the following :
i) Checks the capacity of StringBuffer objects.
ii) reverse the contents of a string given on console and converts the result string in
upper case.
iii) Reads a String from console and appends it to the resultant string of ii.
Assin.-34. Write a program for searching strings for the first occurrences of a character or
substring and for the last occurrence of a character or substring.
Assin.-35. Write a program in Java to read statement from console and convert it into upper case
and again print on console.
Assin.-36. Write a program in java which takes name of the file from the user , read the content
of the file and display it on the console.
Assin.-37. Write a java program to copy a file into another file.
Assin.-38. Write a java applet program which reads your name and address in different text
fields and when button named find is pressed the sum of the length of character in
name and address is display in another text field. Use appropriate colors , layout to
make your applet look good.
Assin.-39. Create an applet which displays rectangle / string with specified color and co-
ordinates passed as a parameter from the html file.
Assin.-.40. Create an applet which will display the calculator.
Assin.-41. Write a java applet program , which provides text area with horizontal and vertical
scroll bar. Type some lines of text in the text area and use scroll bars for movement
in the text area. Read a word in a text field and find whether the word is in the content
of text area or not.
Assin.-42. Write a java program which read the given text file and display the no. of lines,
words and characters present in that file.
Assin.-43. Write an applet to wish the user depends upon the current time.
Assin.-44. Write a java program which accept principal amount, interest rate , period and display
the maturity amount.
Assin.-45. Write a java program to test whether the given expression is valid or not by using
exception handling.