Program List
Program List
Program 2: Write a Java program to display the message “This is just a test”. Pass
these 5 strings as arguments in the main function while executing the program through
cmd.
Program 3: Write a Java Program to make a frequency count of words in a given text
entered by the user.
Program 4: Write a Java program that prompts the user for an integer and then prints
out all prime numbers up to that integer. (use Scanner class to read input).
Program 6: Write a Java program to find the Fibonacci series using recursive and non-
recursive functions.
Week 2 (To study Data types, Scope, and a lifetime of variables, operators,
expressions, and control statements)
Program 1: Write a Java program to identify the symbols of expression given by the
user is the operator or of which datatype.
Program 2: Write a Java program to make a class A in that class declare function add
perform addition through main.
Program 3: Write a Java program to print prime numbers from 1 to 50 using while &
do-while loops.
Program 4: Write a Java program to print the following structure using for loop.
*
**
***
****
*****
****
***
**
*
Program 5: Write a Java program to find the factorial of given number using command
line.
Program 6: Write a Java program to find the volume of the cuboid using this pointer.
Program 7: Write a Java program to swap the value of the speed of bikes by making
class bike using call by value and call by reference
Program 8: Write a Java program to find whether the number is palindrome or not
using recursion.
Program 9: Write a Java program to print all the substrings of the given string
“CODING”.
Program 2: Print the sum, difference, and product of two complex numbers by creating
a class named 'Complex' with separate methods for each operation whose real and
imaginary parts are entered by the user.
Program 3: Write a Java program to create a class Box with data members length,
breadth, and height. Create multiple constructors to assign values to objects in different
ways. Use the overridden “equals” method to compare objects, if found equal then
display the objects using overridden to string method.
Program 3: Create a base class Person and two derived classes as Student and Teacher
with their constructors and methods. Assume the student to be in the same package as
that of Person and Teacher class to be in a different package.
The inheritance hierarchy would appear as follows:
a) Add methods “get” the instance variables in the Person class. These would
consist of: getName, getAge, getGender.
b) Add methods to “set” and “get” the instance variables in the Student class.
These would consist of: getIdNum, getGPA, setIdNum.
c) Write a Teacher class that extends the parent class Person.
Program 4: Describe abstract class called Shape which has three subclasses say
Triangle, Rectangle, Circle. Define one method area() in the abstract class and override
this area() in these three subclasses to calculate for specific object i.e. area() of Triangle
subclass should calculate area of triangle etc. Same should be for Rectangle and Circle.
Program 5: Assume that a bank maintains two kinds of accounts for its customers, one
called savings account and the other current account. The savings account provides
compound interest and withdrawal facilities but no cheque book facility. The current
account provides cheque book facility but no interest. Current account holders should
also maintain a minimum balance and if the balance falls below this level, a service
charge is imposed.
Create a class Account that stores customer name, account number and type of account.
From this derive the classes Curr-acct and Sav-acct to make them more specific to their
requirements. Include the necessary methods in order to achieve the following tasks:
Program 2: Write a Java program that uses interface for the implementation of fixed-
size and dynamic-size stacks (for dynamic stack size should be redefined as per the
number of elements).
Program 4: An array is declared with 5 elements. Then the code tries to access the 6th
element of the array which throws an exception. Write the program for this.
Program 2: Write a Java program that creates three threads. The first thread displays
“Good Morning” every second, the second thread displays “Hello” every two seconds,
and the third thread displays “Welcome” every three seconds.
Program 3: Implement a class that checks whether a given number is prime using both
the Thread class and Runnable interface.
Program 2: Write a method that will remove given character from the String.
Program 4: Write a Java program that computes your initials from your full name and
displays them.
Program 3: Write a java program that simulates a traffic light. The program lets the
user select one of three lights: Red, Yellow or Green with radio buttons. On selecting a
button an appropriate message with “STOP” or “READY” or ”GO” should appear
above the buttons in selected color. Initially, there is no message shown.
Program2: Write a Java application in which wherever the mouse will be clicked. it
keeps printing the coordinates of the clicked.
Program3: Write an applet to display a moving banner showing the status of it.
Program1: Write a java programs to find factorial of a number. user is allowed to enter
a number into the text field whose factorial is to be determined. On pressing the button
the value of the text field is firstly converted into integer and then processed to find its
factorial. The result will get display in another text field. (Hint: use swings)
Program2: Write a java program that works as a simple calculator. Use a Grid Layout
to arrange Buttons for digits and for the + - * % operations. Add a text field to display
the result.
Program3: Write a java program that connects to a database using JDBC and does add,
delete, modify and retrieve operations.