0% found this document useful (0 votes)
102 views1 page

Java BSCS M & E 2018-22

The document outlines a final term paper for a Java class, providing 5 questions to answer that involve writing Java programs to demonstrate object-oriented programming concepts like classes, objects, methods, inheritance, and more. Students are asked to create classes to model real-world entities like students and employees, demonstrate passing objects to methods and accessing properties, and use inheritance between a parent and child class.
Copyright
© © All Rights Reserved
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
0% found this document useful (0 votes)
102 views1 page

Java BSCS M & E 2018-22

The document outlines a final term paper for a Java class, providing 5 questions to answer that involve writing Java programs to demonstrate object-oriented programming concepts like classes, objects, methods, inheritance, and more. Students are asked to create classes to model real-world entities like students and employees, demonstrate passing objects to methods and accessing properties, and use inheritance between a parent and child class.
Copyright
© © All Rights Reserved
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/ 1

DEPARTMENT OF COMPUTER SCIENCE

Subject: JAVA Instructor: M. Haroon Mehmood


Class: BSCS M & E Roll No: .……..

Paper: Final Term Time: 2:30 Hours Total Marks: 50

1. Write a program that takes your full name as input and displays the abbreviations of the
first and middle names except the last name which is displayed as it is. For example, if
your name is Muhammad Haroon Mehmood, then the output should be M.H. Mehmood.
(10)

2. Create a class 'Student' with three data members which are name, age and roll. The
constructor of the class assigns name as of your own name, age as of your own age and roll
of as of your own roll no. It has two members with the same name 'setInfo'. First method
has two parameters for name and age and assigns the same whereas the second method
takes has three parameters which are assigned to name, age and roll respectively. Print the
name, age and roll no of 5 students.
Note: Use array of objects (10)

3. Write a program to print the names of students by creating a Student class. If no name is
passed while creating an object of Student class, then the name should be "Unknown",
otherwise the name should be equal to the String value (Your name) passed while creating
object of Student class.
Note: String value should be your name. (10)

4. A parent class named A has an integer data member 'm' and a method named 'printNum' to
print the value of 'm'. Its child class named B also has an integer data member 'n' and a
method named 'printNum' to print the value of 'n'. Make an object of the child class B and
use it to assign a value of 'n' to 'm'. Now call the method 'printNum' by this object.
(10)

5. Write a program that would print the information (name, year of joining, salary, address) of
three employees by creating a class named 'Employee'. The output should be as follows:
Name Year of joining Address
Robert 1994 64C- WallsStreat
Sam 2000 68D- WallsStreat
John 1999 26B- WallsStreat (10)

You might also like