NPTEL Programming In Java Assignment 3 Answers 2022

NPTEL Programming In Java Assignment 3

Are you looking for the Answers to NPTEL Programming In Java Assignment 3? This article will help you with the answer to the National Programme on Technology Enhanced Learning (NPTEL) Course NPTEL Programming In Java Assignment 3

What is Programming In Java?

With the growth of Information and Communication Technology, there is a need to develop large and complex software. Further, those software should be platform independent, Internet enabled, easy to modify, secure, and robust. To meet this requirement object-oriented paradigm has been developed and based on this paradigm the Java programming language emerges as the best programming environment. Now, Java programming language is being used for mobile programming, Internet programming, and many other applications compatible to distributed systems. This course aims to cover the essential topics of Java programming so that the participants can improve their skills to cope with the current demand of IT industries and solve many problems in their own filed of studies.


Average assignment score = 25% of the average of best 8 assignments out of the total 12 assignments given in the course.
Exam score = 75% of the proctored certification exam score out of 100

Final score = Average assignment score + Exam score

YOU WILL BE ELIGIBLE FOR A CERTIFICATE ONLY IF THE AVERAGE ASSIGNMENT SCORE >=10/25 AND EXAM SCORE >= 30/75. If one of the 2 criteria is not met, you will not get the certificate even if the Final score >= 40/100.

Below you can find the answers for NPTEL Programming In Java Assignment 3

Assignment No.Answers
Programming In Java Assignment 1 Click Here
Programming In Java Assignment 2 Click Here
Programming In Java Assignment 3 Click Here
Programming In Java Assignment 4 Click Here
Programming In Java Assignment 5 Click Here
Programming In Java Assignment 6 Click Here
Programming In Java Assignment 7 Click Here
Programming In Java Assignment 8 Click Here

NPTEL Programming In Java Assignment 3 Answers:-

Q1.This program is related to the generation of Fibonacci numbers.

For example: 0,1, 1,2, 3,5, 8, 13,… is a Fibonacci sequence where 13 is the 8th Fibonacci number.

A partial code is given and you have to complete the code as per the instruction given below.


if (n==1)      
            return 0;
        else if(n==2)
            return 1; 			
return fib(n - 1) + fib(n - 2); 

Q2. Define a class Point with two fields x and y each of type double. Also, define a method distance(Point p1, Point p2) to calculate the distance between points p1 and p2 and return the value in double.

Complete the code segment given below. Use Math.sqrt( ) to calculate the square root.

class Point{
  double x;
  double y;

public static void distance(Point p1,Point p2){
        double d;
	  d=Math.sqrt((p2.x-p1.x)*(p2.x-p1.x) + (p2.y-p1.y)*(p2.y-p1.y));

???? Next Week Answers: Assignment 04 ????

quizxp telegram

Q3. A class Shape is defined with two overloading constructors in it. Another class Test1 is partially defined which inherits the class Shape. The class Test1 should include two overloading constructors as appropriate for some object instantiation shown in main() method. You should define the constructors using the super class constructors. Also, override the method calculate( ) in Test1 to calculate the volume of a Shape.

//Create a derived class constructor which can call the one parametrized constructor of the base class
//Create a derived class constructor which can call the two parametrized constructor of the base class
//Override the method calculate() in the derived class to find the volume of a shape instead of finding the area of a shape

	double height;
	Test1(double length,double h) {

	Test1(double length,double breadth,double h) {


	double calculate()	{
		return length*breadth*height;

Salesforce off campus Drive 2022 | Intern | Any Graduate | Bangalore/Hyderabad

Q4. This program to exercise the call of static and non-static methods. A partial code is given defining two methods, namely sum( ) and multiply ( ). You have to call these methods to find the sum and product of two numbers. Complete the code segment as instructed.  

//Called the method sum() to find the sum of two numbers.
//Called the method multiply() to find the product of two numbers.

QuestionScope st = new QuestionScope(); 
      int result1=st.sum(n1,n2); 
      int result2=QuestionScope.multiply(n1,n2);	

Q5. Complete the code segment to swap two numbers using call by object reference.

static void swap(Question obj)
          int temp;

For other courses answers:- Visit

For Internship and job updates:- Visit

Disclaimer: We do not claim 100% surety of answers, these answers are based on our sole knowledge, and by posting these answers we are just trying to help students, so we urge do your assignment on your own.

if you have any suggestions then comment below or contact us at [email protected]

If you found this article Interesting and helpful, don’t forget to share it with your friends to get this information.