Java Internal and External
Java Internal and External
a) Write a JAVA program to display default value of all primitive data type of JAVA.
b) Five Bikers Compete in a race such that they drive at a constant speed which may or may
not be the same as the other. To qualify the race, the speed of a racer must be more than the
average speed of all 5 racers. Take as input the speed of each racer and print back the speed
of qualifying racers.
Exercise - 2
Write a JAVA program to search for an element in a given list of elements using binary
search mechanism.
Exercise - 3
Write a JAVA program to sort for an element in a given list of elements using bubble sort.
Exercise - 4
Define a class called CalAge . This class is used to calculate age of a person from her or his
date of birth and the current date. Include a mutator method that allows the user to enter her
or his date of birth and set the value for current date. Also include a method to return the age
in years and months (for example, 25.5 years) as a double value. Include an additional
method to check if the date of birth entered by the user is a valid one. For example, 30
February 2008 is an invalid date. Embed your class in a test program.
Exercise - 5
Write a program to simulate a buzzer. The program should make use of the Thread class.
Create a class named Buzzer that extends the Thread class. Create an interface named
MonitorTime which contains a method setBuzzerTime() . Your Buzzer class should
implement this interface. Override setBuzzerTime() method to set the buzzer time delay in
milliseconds and the number of times the buzzer should be repeated. Also, include
methodsblowBuzzer to start the buzzer.
Exercise - 6
Write a Java program which first generates a set of random numbers and then determines
negative, positive even, positive odd numbers concurrently.
Exercise - 7
Write a Java program which handles Push operation and Pop operation on stack concurrently.
Exercise - 8
Create a class named Employee that can be used to calculate the salaries of different
employees. The Employee class should keep a track of the employee ID, name, department,
salary, and designation with appropriate accessor and mutator methods. Also create an
equals() method that overrides Object’s equals() method, where employees can check if their
designation is identical. Next, create two additional classes named Manager and Clerk that
are derived from Employee . Create an overridden method name
Exercise - 9
Write a JAVA program that display the x and y position of the cursor movement using Mouse
Exercise - 10
Define a class to maintain bank accounts of customers. The program should place the code
into a try-catch block with multiple catches to check for the validity of various attributes
based on the following criteria. 1. Customer ID must start with a letter and should be
followed by three digits. 2. Account number must be of five digits. 3. Initial balance must be
above $1000. Print suitable error matches within the catch block. If any of the criteria
mentioned above is not fulfilled, the program should loop back and let the user enter new
data.
Exercise - 11