0% found this document useful (0 votes)
0 views6 pages

Assignment 01 JavaProgramming

The document outlines the instructions for completing Assignment_01 for Java Programming, which includes creating a folder, coding questions, and submission guidelines. Students are required to implement various programming tasks involving classes, objects, inheritance, and interfaces, along with deadlines for submission. Additionally, students must create a video presentation of their assignment and submit it via a provided link.

Uploaded by

utsavnautiyal2
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)
0 views6 pages

Assignment 01 JavaProgramming

The document outlines the instructions for completing Assignment_01 for Java Programming, which includes creating a folder, coding questions, and submission guidelines. Students are required to implement various programming tasks involving classes, objects, inheritance, and interfaces, along with deadlines for submission. Additionally, students must create a video presentation of their assignment and submit it via a provided link.

Uploaded by

utsavnautiyal2
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/ 6

Assignment_01

Unit_01 && Unit_02


Java Programming [TCS-408]

Instructions:
1- Create a folder name Assignment_01 in the same workspace where
you have created Unit_01 and Unit_02. Kindly follow the image.

2- Create Q1, Q2, Q3 and so on for all coding related questions in this
assignment

3- Deadlines and Links:


- You guys are supposed to complete this assignment by
11PM 28th April 2022 over GitHub and the video by 5PM
8th May-2022.
- Use the given link to provide the GitHub link for this
assignment. Choose Assignment_01 from the list.
- Link:
https://forms.office.com/r/5gTEjej6CK
4- Post exam you guys have to submit a small video of this
assignment in given format and order:
a. Use Project or Thread file [A4 Size]
b. Take printout of all the codes with their terminal output
from Assignment_01 folder you have created in the
same work space
c. All the pages would be of A4 size
d. First page would be your information page
e. After first page put the print out of this Assignment_01
[Take printout of this pdf]
f. Now at last, Combine all the answers [Handwritten and
Printouts] according to the order of the questions.

5- Now create a small video of this Assignment_01 from phone


and flip the pages of the file slowly.

6- Do upload this small video [30 seconds expected], over your


G-drive

7- Now create a public link of this video [use share with


everyone with this link option]

8- Finally, use this link to upload the link of your video.


https://forms.office.com/r/5gTEjej6CK
Questions:
Q1- WAP which would contain 6 objects, of a class
Student. Student [Name, Age, section, percentage]. They all belong to
Section-A. Your program would be able to find the average percentage of
students in this section. Use constructors to create these 6 objects and
input from Scanner class.

Q2- WAP to count the total number of calls for a member function from
more than one objects. [Let’s say, from 3 such Objects]

Q3- Given an interface in1 which includes a method display which takes
an integer as input .
interface In1
{
void display(int p);
}
Task is to write a class testClass which implements interface In1 and has
a method named display which takes an integer as an input p and the
display method should be able to tell if the number is prime or not?
- The main method should not be in testClass, create a separate class for
that.

Q4. Create a multi-level inheritance hierarchy from ClassOne, ClassTwo,


ClassThree classes.

ClassOne contains one, single parameterized constructor


ClassTwo contains only a default constructor
ClassThree contains one, single parameterized constructor and a default
constructor.

Create an object of top child class and make sure the constructor
execution will take place according to respective multi-level inheritance
hierarchy.

ClassThree obj = new ClassThree(1);


ClassThree obj = new ClassThree();
5Q. WAP in Java which would contain 8 objects of a Class Employee.
Employee contains name, age, department, salary. Your program would
be able to calculate the total salary to be paid in each department. Use
constructors to create these 8 objects and Scanner to take inputs.

Restrictions:
1- Minimum 8 objects [can be created manually with parameterized
constructors with Scanner input]
2- Departments are, A, B, C, D: minimum 4 departments [String Type]
3- If the Salary exceeds more than 30,000, then the default salary
would be 25000 of any of the employee
4- Use array of objects, instead of using multiple 8 objects separately
Use:
Employee arr[] = new Employee[8];

And

arr[i].department.equals("A");

Q6. As given there are two sample methods: First one returns the sum of
two numbers a and b and second one returns the subtraction of a and b. if
a-b is negative then return value would be 0. Use ternary operator to call
these two methods. If a>b then ternary should call sum(a,b) but if a<b
then ternary operator should call sub(a,b). Eventually print the result of
the ternary operation on variable a and b.
Note: Ternary operator can call a method even for true and false values

Q7. WAP to count the total number of calls for a member function:
display(), from more than one objects and how many times the object is
created of a class name Employee.
Note: Call display() function from more than 3 objects

Q8. WAP in java, to delete index=3, element from the given array
mentioned below.

Int[] arr = {1,2,3,4,5,6,7,8,9}


Note: Non relevance places would be filled with zeros.

Q9. WAP in java, which would demonstrate access protection over a


class and a variable of that class.
Note: class can be public and default while variable can be default,
private, protected, and public.
(If required then do create more than 2 packages)

Q10. WAP in Java Program To Survey Four Different Car Models For Four
Different Cities:

Your job is to find out the total number of cars sold of each model in all
the cities. Use Array of objects or multiple objects of class name City.

Q11. As given there are two sample methods: First one returns the sum of
two numbers a and b and second one returns the subtraction of a and b. if
a-b is negative then return value would be 0. Use ternary operator to call
these two methods. If a>b then ternary should call sum(a,b) but if a<b
then ternary operator should call sub(a,b). Eventually print the result of
the ternary operation on variable a and b.
Note: Ternary operator can call a method even for true and false values

Q12. If We Place Return Type In Constructor Prototype Will It Leads To


Error?

Q13. How Compiler And Jvm Can Differentiate Constructor And Method
Definitions Of Both Have Same Class Name?

Q14. Can we create a private constructor?

Q15. Can we have a Constructor in an Interface?

Q16. Describe various forms of implementing interfaces and extending


an Abstract Class. Explain it with suitable examples.
Note:
Interface:
1. Functional Interface [only on abstract method, like
runnable ]
2. Marker interface [0-any abstract methods]

Abstract Class:
1. Pure or 100% abstract class
2. Normal Abstract Class [0-100% abstract methods]

Q17. How a 100% abstract class is different from an Interface. Provide


suitable code if required.

Q18. How local static variable is different from global static variable?

Q19. Why we cannot create a private and protected class in Java?

Q20. What happens if we add final keyword with Class, Method and a
variable in java. Explain it through suitable code if required.

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