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

Java Assignment 2018 - 3rd Year-1

This document outlines 30 Java programming lab assignments that students must complete, including: 1) Writing programs to calculate circle area and perimeter from command line arguments, count vowels/consonants in a message, and convert inches to meters. 2) Creating classes like Circle, Employee, Manager, and Box with methods like getData(), calArea(), accept(), display(), and findVolume(). 3) Implementing inheritance, polymorphism, abstract classes, interfaces, exceptions, threads, file I/O, and database connectivity. 4) The assignments cover core Java concepts and are due by November 23rd, 2018.

Uploaded by

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

Java Assignment 2018 - 3rd Year-1

This document outlines 30 Java programming lab assignments that students must complete, including: 1) Writing programs to calculate circle area and perimeter from command line arguments, count vowels/consonants in a message, and convert inches to meters. 2) Creating classes like Circle, Employee, Manager, and Box with methods like getData(), calArea(), accept(), display(), and findVolume(). 3) Implementing inheritance, polymorphism, abstract classes, interfaces, exceptions, threads, file I/O, and database connectivity. 4) The assignments cover core Java concepts and are due by November 23rd, 2018.

Uploaded by

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

JAVA PROGRAMMING LAB ASSIGNMENT

DEPARTMENT OF COMPUTER SCIENCE AND TECHNOLOGY


K G Engineering Institute, Bishnupur, Bankura Last Date of Submission: 23rd Nov, 2018

1. Write a Java program to print the area (R - radious) and perimeter of a circle using command line argument.
2. Write a program, which takes a message from an user and count the number of vowels, consonant, and extra character.
3. Write a Java program that reads a number from command line in inches, converts it to meters.
4. Write a program for demonstrating Call by value and call by reference.
5. Write a Java program to insert an element (specific position) into an array.
6. Write a class circle which consists two methods getData() and calArea(), and also write a main program to create a circle object and to find the
area by calling the method calArea() in circle class and display the result.
7. Define a class Employee having members–id (private data member), name, department, salary. Define default and parameterized constructors.
Create a subclass called “Manager” with private member bonus. Define methods accept and display in both the classes. Create an objects of the
Manager class and display the details of the manager having the maximum total salary (salary+bonus)
8. Write a class Box with the variable width, depth and height and constructor to assigning the values for these variables and a method to find the
volume of the box and also write the main program, which creates the box object, and find the volume of the box.
9. Write a program to demonstrate the method overloading and overriding and also write another program for preventing method overriding.
10. Create an abstract class Shape with methods calArea() and calVol(). Derive four classes Sphere(radius), Cone(radius, height), Cylinder(radius,
height) and Box(length, breadth, height) from it. Calculate the area and volume for all. (Use Method overriding)
11. Write a program for initializing base class constructor from derive class constructor. Also write a program for Constructor overloading.
12. Write a program for implementing Java does support multiple interface not multiple inheritance.
13. Create another class student, which has stdid, stdname, stddob and marks of 3 subjects as member. Write appropriate constructor for the student
which assigns values to the members. Accept the details as command line arguments and create a student object using the arguments. Display the
student details in proper format.
14. Create an abstract method called getArea() that calculates and returns the area of a shape as a double.
15. Write a program to create a thread by extending the thread class. Create a class Student with attributes rollno, name, age and course. Initialize
values through parameterized constructor. If age of student is not in between 15 and 21 then generate user-defined exception
“AgeNotWithinRangeException”. If name contains numbers or special symbols raise exception “NameNotValidException”. Define the two
exception classes.
16. Write a Java program to compare a given string to the specified string buffer. Also write another program for differentiating String, String Buffer and Builder Class.
17. Define a class CricketPlayer (name, no_of_innings, no_times_notout, total_runs, bat_avg). Create an array of n player objects. Calculate the batting
average for each player using as static method “bat_avg()”. Define a static method “sort_Player()” which sorts the array on the basis of average.
Display the player details in sorted order.
18. Create a package named “Maths”. Define class MathOperations with static methods to find the maximum and minimum of three numbers. Create
another package “Stats”. Define class “StatOperations” with the methods to find the average of three numbers. Use these methods in main to
perform operations on three integers accepted using command line arguments.
19. Write a program to create a super class “Vehicle” having members as company and price. Derive 2 different classes “LightMotorVehicle” (mileage as
float) and “HeavyMotorVehicle” (member data as capacity_in_tons as integer). Accept the information for n vehicles and display the information in
appropriate form. While taking data, ask the user about the type of vehicle first.
20. Given a string, return a new string where the last 3 chars are now in upper case. If the string has less than 3 chars, uppercase whatever is there.
21. Write a program to find the vowel of a inputed string and generate the substring using the vowel you have inserted.
22. Create two threads and show both threads are running simultaneously.
23. Write a program for showing an exception for “NegativeNumberException”. i.e. the inputed number is negative or not.
24. Define a class which contains method “DisplayColor” which takes one character as argument. Raise as error if the character in not an alphabet. If the
alphabet is color of the rainbow, display the color name. if it is any other alphabet, report an error.
25. Write a program to count occurrences of a string with in a text file.
26. Write a program to display the contents of a file in the reverse order.
27. Write a simple applet program to draw different shapes (Line, rectangle, oval, polygon, rounded rectangle etc.) in applet.
28. Write a code for passing arguments to an applet.
29. Create an applet with Labels (One, Two & Three), Buttons (Yes, No, Undecided) when user click any button show message regarding user click, add
Checkboxes(Windows 98/XP, Windows NT/2000) when user chose any checkbox show message regarding user choice & add text boxes (name,
password) and text on these textboxes should be displayed on Applet.
30. Write a program for connecting with the Oracle database with select, insert, delete and update record from the database.

You might also like