Lab #1: Operators and expressions
1. Write a program to convert centigrade to Fahrenheit. [F = 9/5 * C + 32]
2. Write a program that calculates the area of a circle and circumference.
3. Write a program that calculates the area of a triangle.
4. Write a program that reads the marks in each subject and calculates the
percentage.
Lab #2: Conditional Statements
1. Write a program that reads a number and identifies whether the given
number is even or odd.
2. Write a program to find the largest number among two numbers
3. Write a program to read the mark of a subject and prints the equivalent
grade.
Lab #3: Loop
1. Write a program to read a sentence and counts the total number of character
(excluding space) using while loop.
2. Write a program to generate Fibonacci number using do while loop.
3. Write a program to read number and identify whether the given number is a
prime number or not.
4. Write a program to identify whether the given number is a perfect number or
not. 28 is a perfect number.
5. Write a program to calculate the factorial of a given number.
Lab #4: Array
1. Write a program to store ‘n’ numbers in a one-dimensional array and
calculate its mean and mode.
2. Write a program to convert a user given binary number to decimal.
3. Write a program to evaluate transpose of n by n matrix.
4. Write a program for matrix addition. The user will provide dimensions and
elements of both matrices.
Lab #5: Sorting
1. Write a program to arrange the numbers (array) in ascending order using
bubble sort.
2. Write a program which asks the user to input ‘n’ words. Now Display the
words in dictionary order.
Lab #6: Classes and Methods
(All the programs below should be carried out by creating class and implementing the class with objects)
1. Write a program to test whether the given number is prime or not.
2. Write a program in java to input name of student and marks obtained in 5 subjects.
Calculate total, percentage and result.
3. Write a program in java to input two numbers and calculate sum, difference, product
and quotient.
Lab # 7: More on interfaces, constructors and methods
1. Write a program of a bank account with class Bank account which implements interface
bank.
2. Write a Java Program to define a class, describe its constructor, overload the
Constructors and instantiate its object.
3. Write a Java Program to define a class, define instance methods for setting and
retrieving values of instance variables and instantiate its object.
4. Write a Java Program to define a class, define instance methods and overload them and
use them for dynamic method invocation.