Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
31 views

Lab Assignments 2023

The document outlines 19 Java programming assignments covering topics like finding the largest/prime numbers in an array, Fibonacci series, factorials, checking if a number is odd/even or a string is a palindrome, matrix operations, exception handling, file I/O, and string operations.

Uploaded by

vaibhavmishr8707
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
31 views

Lab Assignments 2023

The document outlines 19 Java programming assignments covering topics like finding the largest/prime numbers in an array, Fibonacci series, factorials, checking if a number is odd/even or a string is a palindrome, matrix operations, exception handling, file I/O, and string operations.

Uploaded by

vaibhavmishr8707
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Lab-based Assignments on Java

1. Write a java program to find the largest of n natural numbers.


2. Write a java program to find whether a given number is prime or not.
3. Write a menu-driven program in java for the following:
a) Display a Fibonacci series
b) Compute the Factorial of a number
c) To check whether a given number is odd or even
d) To check whether a given string is palindrome or not
4. Write a java program to print the sum and product of digits of an Integer and reverse the Integer.
5. Write a java program to create an array of 10 integers. Accept values from the user in that array. Input
another number from the user and find out how many numbers are equal to the number passed, how
many are greater, and how many are less than the number passed.
6. Write a java program that will prompt the user for a list of 5 prices. Compute the average of the prices
and find out all the prices that are higher than the calculated average.
7. Write a program in java to input N numbers in an array and print out the Armstrong numbers from the
set.
8. Write a java program for the following matrix operations:
a) Addition of two matrices
b) Product of two matrices
c) Transpose of a matrix
9. Write a java program that computes the area of a circle, rectangle, and triangle using function
overloading.
10. Write a java program for the implementation of multiple inheritance using interfaces to calculate the
area of a rectangle and triangle.
11. Write a java program to create a frame window in an Applet. Display your name, address, and
qualification in the frame window.
12. Write a java program to draw a line between two coordinates in a window.
13. Write a java program to display (i) Rectangle (ii) Circle (iii) Ellipse (iv) Arc and (v) Polygon in an
applet window.
14. Write a java program that reads two integer numbers for the variables a and b. If any other character
except number (0–9) is entered then the error is caught by NumberFormatException object. After that
ex.getMessage() prints the information about the error occurring causes.
15. Write a java program for the following string operations:
a) Compare two strings
b) Concatenate two strings
c) Compute the length of a string
16. Create a class called Fraction that can be used to represent the ratio of two integers. Include appropriate
constructors and methods. If the denominator becomes zero, throw and handle an exception.
17. Write a java program that reads a file and displays the content of the file on the screen, with a line
number before each line.
18. Write a java program that reads a given text file and writes its content in another output file.
19. Write a java program that reads a given text file and counts the number of words.

You might also like