0% found this document useful (0 votes)
7 views

Unit-3 - Practical Assignment

Uploaded by

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

Unit-3 - Practical Assignment

Uploaded by

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

GLS UNIVERSITY

FACULTY OF COMPUTER APPLICATIONS AND IT


BCA-SEM-IV
0301405 - PRACTICAL ON CORE JAVA
ASSIGNMENT – 3

1. Write a program in java to take an 2D array from user and display sum of all even
numbers present in that array.
2. Write a program in java to take an 2D array from user and display all prime numbers
present in that array.
3. Write a program in java to take an 2D array from user and display all elements if array
in ascending order.
4. Write a program to create an array of any user defined size and print all even numbers
and odd numbers in a specified range.
5. Create 1D array of 10 numbers and print them in descending order.

6. Demonstrate the use of variable argument list with the help of an example.

7. Write a program which take an array as an argument to a function, sort it and return it
back to main program.
8. Define a class MotorVehicle to take modelName, modelNumeber, modelPrice, and a
method display() to display these details. Create another class Car which inherits the
class MotorVehicle and has the member discountRate and having display() method to
display details. Test this class with suitable constructor. If necessary use the super
keyword.
9. Consider an employee class, which contains fields such as name and designation. And a
subclass, which contains a field salary. Write a program for inheriting this relation.
10. Write a program to find Maximum element from an Array.

11. Write a program to calculate arithmetic mean in the superclass and standard deviation
in the subclass.
12. Write a program to calculate the area of circle, Rectangle & Square by using interface.

13. Write an interface called Numbers with a method int process(int x,int y). Write a class
called Sum in which the process() method finds the sum of two numbers and returns an
int value. Write another class called Average in which the process() method finds the
average of the two numbers and returns an int value.
14. Create a class name Book that contains data fields for the title and number of pages.
Include get and set methods for these fields. Next, create a subclass named Textbook,
which contains an additional field that holds a grade level for the Textbook and
additional methods to get and set grade level field. Write an application that
demonstrates using objects of each class.
15. Write a program in Java in which a subclass constructor invokes the constructor of the
super class and instantiate the values.
16. Write a program in Java to demonstrate implementation of multiple inheritance using
interfaces.
17. Create a class with a method that prints "This is parent class" and its subclass with
another method that prints "This is child class". Now, create an object for each of the
class and call -
method of parent class by object of parent class
method of child class by object of child class
method of parent class by object of child class

18. Write a Java Program to create a simple class to find out the Area and perimeter of
rectangle and box using super and this keyword.
19. Write a Java program to create an interface area having pie as its data members and a
method compute(float, float)
20. Create a class result which implements sports interface having data member total (stores
total of three subject marks) and percentage (total + sportmarks). Calculate the
percentage and grade and display the same.
21. Create a class named 'Rectangle' with two data members 'length' and 'breadth' and two
methods to print the area and perimeter of the rectangle respectively. Its constructor
having parameters for length and breadth is used to initialize length and breadth of the
rectangle. Let class 'Square' inherit the 'Rectangle' class with its constructor having a
parameter for its side (suppose s) calling the constructor of its parent class as 'super(s,s)'.
Print the area and perimeter of a rectangle and a square.
22. Create a class named 'Shape' with a method to print "This is This is shape". Then create
two other classes named 'Rectangle', 'Circle' inheriting the Shape class, both having a
method to print "This is rectangular shape" and "This is circular shape" respectively.
Create a subclass 'Square' of 'Rectangle' having a method to print "Square is a
rectangle". Now call the method of 'Shape' and 'Rectangle' class by the object of 'Square'
class.

Program Allocation as per below table -

Roll Number Questions

A1 to A10, B1 to B10, C1 to C10 1,11,10,5,3,16

A11 to A20, B11 to B20, C11 to C20 2,12,9,6,3,17

A21 to A30, B21 to B30, C21 TO C30 3,13,8,7,16,18

A31 to A40, B31 to B40, C31 TO C40 4,14,7,8,3,19

A41 to A50, B41 to B50, C41 TO C50 5,15,6,9,3,20

A51 to A60, B51 to B60, C51 TO C60 6,11,5,10,3,21

A61 to A70, B61 to B70, C61 TO C70 7,12,4,1,3,22


A71 to A80, B71 to B80, C71 TO C80 8,13,3,2,16,21

A81 to A90, B81 to B90, C81 TO C90 9,14,2,3,16,20

A91 Onwards, B91 Onwards,C91 Onwards 10,15,1,4,3,19

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy