We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4
B.E / B.Tech.
PRACTICAL END SEMESTER EXAMINATIONS, NOV/DEC 2024
Third Semester CS4357 – JAVA PROGRAMMING LABORATORY (Regulations 2022) Time: 3 Hour Answer any one Question Max. Marks: 100
Aim & Program Results Viva-Voce Record Total
Procedure (40) (20) (10) (10) (100) (20)
a) Write a java program that remove duplicates elements form an array.
1 b) Create a Java program that prompts the user for an integer and then prints out all prime numbers up to that Integer. a) Write a java program to find the Fibonacci series using recursive functions. 2 b) Write a java program to find the Fibonacci series using non-recursive functions. Develop a Java application to generate Electricity bill. Create a class with the following members: Consumer no., consumer name, previous month reading, current month reading, type of EB connection. Compute the bill amount using the following tariff and calculate the amount to be 3 paid as follows: First 100 units - Rs. 1 per unit, 101-200 units - Rs. 2.50 per unit, 201 -500 units - Rs. 4 per unit and 501 units - Rs. 6 per unit Develop a java application to implement currency converter (Dollar to INR, EURO to INR, Yen 4 to INR and vice versa), distance converter (meter to KM, miles to KM and vice versa), time converter (hours to minutes, seconds and vice versa) using packages. Develop a java application with Employee class with Emp_name, Emp_id, Address, Mail_id, Mobile_no as members. Inherit the classes, Programmer, Assistant Professor, Associate Professor 5 and Professor from employee class. Add Basic Pay (BP) as the member of all the inherited classes with 97% of BP as DA, 10 % of BP as HRA, 12% of BP as PF, 0.1% of BP for staff club fund. Generate pay slips for the employees with their gross and net salary. Create a Java application to create an abstract class named Shape that contains two integers and an empty method named Print_Area (). Provide three classes named Rectangle, Triangle and 6 Circle such that each one of the classes extends the class Shape. Each one of the classes contains only the method Print_Area () that prints the area of the given shape. Design a Java interface for ADT Stack. Implement this interface using array. Provide necessary 7 exception handling in both the implementations. Develop a Java application to generate all possible permutations of a given string using recursive 7 method. The method should print each permutation on a new line. Example: For the input string "ABC", the output should be: ABC, ACB, BAC, BCA, CAB, CBA a) Write a Java program to implement user defined exception handling. Display the result for the following input a=1, b=0 perform c=a/b. b) Write a java program to throw an exception (checked) for an employee detail. If an employee 8 name is a number, a name exception must be thrown, if an employee age is greater than 50, an age exception must be thrown or else an object must be created for the entered employee details. a) Program to take String input from Keyboard using Scanner class and write string input into the file using FileWriter class in java. 9 b) Write a Java program that reads a file name from the user, displays information about whether the file exists, whether the file is readable, or writable, the type of file and the length of the file in bytes. a. Write a Java program to find the sum value of two given type of elements using a generic function. 10 b. write a java program to find the maximum value from the given type of elements using a generic function. a) Create a bank database application program in java to handle simple cash deposit and 11 withdraw operation using multithreading. b) Write a java program for producer and consumer problem using Threads. a) Write a java program that implements a multi-threaded application that has three threads. First thread generates a random integer every 1 second and if the value is even, second thread computes the square of the number and prints. If the value is odd, the third thread will print 12 the value of cube of the number. b) Write a java program that prints numbers from 1 to 10 line by line after every 5 seconds using multi-threaded. Write a java program that works as a simple calculator. Use a Grid Layout to arrange Buttons for 13 digits and for the + - * % / operations. Add a text field to display the result. a) Write a java program to handle mouse events 14 b) Write a java program to handle keyboard events To Write a Java Program to create an abstract class named sumOfTwo and sum of Three. Perform 15 addition of two numbers and addition of three numbers. Develop the Internal mark calculation system based on the attendance percentage using inheritance concepts Java. Get the student’s name, register number, total number of working days in the semester and Number of days present. Calculate attendance percentage of the students and 16 award attendance mark based on the following condition. Attendance percentage >=90 – 5 Marks, Attendance percentage >=80 and < 90 – 4 Marks, Attendance percentage >=75 and < 80 – 3 Marks, Attendance percentage < 75 - 0 Marks 17 Write a java program to insert an element into an array and reverse an array using packages. Write a program to exhibit simple inheritance, multilevel inheritance and hybrid inheritance 18 concepts. a) Write a program to Check Prime Number using Interface. 19 b) Write a Java Program to Check a Leap Year using inheritance concept. Write a program to exhibit simple inheritance, multilevel inheritance and hybrid inheritance 20 concepts. Write a Java program to generate the phone bill using inheritance concepts with the following members: Consumer Number, Consumer Name, and Number of calls. Generate the bill using the 21 following rules: Up to 99 calls – 25 paise per call, 100 to 199 calls – 50 paise per call, 200 to 299 calls – 75 paise per call and Above 300 calls – RS 1 per call Develop a Java Application to implement Temperature conversion Fahrenheit to Celsius, 22 Fahrenheit to Kelvin, Celsius to Kelvin and vice versa using packages. Fahrenheit to Celsius => C = (F-32) *5/9 and Celsius to Kelvin => K= C + 273.15 Develop a Java Application with Vehicle Class with vehicle type, vehicle number, engine number, chassis number as member. Inherit the classes bicycle, car, bike, and lorry from vehicle 23 class. Add top speed, number of passengers, number of gears for Passenger vehicle, and if is not a passenger vehicle, add total amount of load to carry to the respective inherited classes. Generate a report for the vehicles. Write a java program to create an abstract class “bike” which contains accelerate () and brake () 24 as abstract method and extend this “bike” abstract class in sports bike class and economy bike class. a) 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. 25 Get two inputs Float and the output must be an Integer. b) 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%. a) Develop a java application to implement distance converter (meter to KM, miles to KM and 26 vice versa) using packages. b) To find the maximal number in the range of an Array. a) Develop a java application to implement time converter (hours to minutes, seconds and vice 27 versa) using packages. b) To find the minimum number in the range of an Array. Write a java program that illustrates the following 28 a) Creation of simple package. b) Accessing a package. Write a java program that illustrates the following 29 a) Handling predefined exceptions. b) Handling user defined exceptions a) Write a java program to find whether the number is odd or even numbers in an array. 30 b) Write a java program to check whether the given string is a palindrome. a) Write a java program that arranges the given set of strings in alphabetical order. 31 b) Write a java program that print the string in reverse order. Write a java program to perform the following functions using classes, objects, constructors and inheritance were essential. 32 i)Get as input the marks of 5 students in 5 subjects ii) Calculate the total and average iii)Print the formatted results on the screen