Q.No Aim/Principle/Apparatus Required/procedure Tabulation/Circuit/ Program/Drawing Calculation & Results Viva-Voce Record Total 1 5 25 10 10 10 100 2 5 25 10 Experiment List
Q.No Aim/Principle/Apparatus Required/procedure Tabulation/Circuit/ Program/Drawing Calculation & Results Viva-Voce Record Total 1 5 25 10 10 10 100 2 5 25 10 Experiment List
(Regulations 2017)
1. An Electricity Board charges the following rates to domestic users to discourage large
consumption of energy:
For the first 1 - 200 units { 1 - 100 units = Rs. 1.00, 101 - 200 units = Rs.1.50 }
From 201 - 500 units{ 1 - 200 units = Rs. 2.00 and 201 - 500 units = Rs. 3.00 }
Above 500 units{ 1 - 200 = Rs. 3.50, 201- 500 unit = Rs. 4.60 &above 500 unit Rs.6.60}
Write a Java program to read the connection_id of users and number of units consumed, print out
the charges with names.
2. Create a base class called "shape". Use this class to store two double type values that could be
used to compute the area of figure. Derive two specific classes called triangle and rectangle
from the base shape. Add to the base class, a member function get_data() to initialize base class
data members and another member function display_area() to compute and display the area of
figure. Make display_area() as a virtual function and redefine this function in the derived classes
to suit their requirements.
Using these three classes, design a program that will accept dimensions of triangle or a rectangle
interactively, and display the area. Remember the two values given as input will be treated as
lengths of two sides in the case of rectangles, and as base and height in the case of triangles, and
used as follows:
Area of rectangle = x * y ; Area of triangle = (1/2) * x * y
3. Write a java program to perform the arithmetic operations using the concept
of method overloading
Get two inputs Integer and the output must be a float.
Get two inputs Float and the output must be an Integer.
Write a java program to perform the concept of method overriding for calculating simple interest
of 3 banks A,B,C. Using dynamic method dispatch, Bank A’s rate of interest-10%, Bank’s B
rate of interest-9%, Bank’C rate of interest -7%.
4. Write a java program to find the roots of a quadrat ic equation using interface
and packages.
Declare a interface in package Quad1
Declare another package Quad2 and implement the interface.
Page 2 of 3
6. (a). Write a Java program that will accept an integer and convert it into a binary representation.
Now count the number of bits which is equal to zero of the said binary representation.
(b). Write a Java program to check if three given side lengths (integers) can make a triangle or
not.
7. (a). Write a Java program to takes the user for a distance (in meters) and the time was taken (as
three numbers: hours, minutes, seconds), and display the speed, in meters per second,
kilometers per hour and miles per hour (hint: 1 mile = 1609 meters).
(b). Write a Java program to convert minutes into a number of years and days.
9. Write a Java program to find and print the first 10 happy numbers.
* Happy number: Starting with any positive integer, replace the number by the sum of the
squares of its digits, and repeat the process until the number equals 1, or it loops endlessly in a
cycle which does not include 1.
Example:
19 is a happy number
12 + 92 = 82
82 + 22 = 68
62 + 82 = 100
12 + 02 + 02 = 1
10. Write a java program to perform the following operat ions based upon the choice
entered by the user.
1.Reading input from a File(f1) and displaying it in the console
2.Read the input from the program itself and write to the F ile(f2)
3 . C o n c a t e n a t i o n o f F i l e s ( f 1 a n d f 2 ) f3
Appending information to file f3
Perform word count on f3
11. Write a Java program that takes the user to provide a single character from the alphabet. Print
Vowel or Consonant, depending on the user input. If the user input is not a letter (between a and
z or A and Z), or is a string of length > 1, print an error message.
12. Write programs for using Graphics class - to display basic shapes and fill them - draw different
items using basic shapes - set background and foreground colors.
Page 3 of 3
13. Design a Java interface for ADT List. Implement this interface using array.
append the specified element to the end of a linked list.
insert elements into the linked list at the first and last position.
insert the specified element at the specified position in the linked list.
display the elements and their positions in a linked list
14. Write a java program to implement the following Predefine Excepting handling with suitable
example.
illustrate ArrayIndexOutOfBound Exception
NumberFormatException
NullPointerException
16. Write a java program to implement interfaces and packages sort the set of numbers and a set
strings in a given array. ( get the input from console).
17. Write a java program to solve producer consumer problem which generates characters using
threads.
18. Write a java program that implements a multithread application that has three threads. First
thread generates random integer every one second and if the value is odd, second thread
computes the square of the number and prints the value is even, the third will print the cube of
the number.
19. Write a Java method to compute the future investment value at a given interest rate for a
specified number of years.
20. Design a loan calculator using event-driven programming paradigm of Java. Compute the
regular payments on a loan such as a car or house loan. Simply enter the loan principal, the
length of the loan in years, and the interest rate. The payments are assumed to be monthly. Once
the information is entered, press Compute to calculate the monthly payment.
*********