Programming In Java Week 2: Programming Assignments Jan-Jun 2022

NPTEL PROGRAMMING ASSIGNMENTS

Programming In Java Week 2: Programming Assignments Jan-Jun 2022


Week 2 : Programming Assignment 1

Due Date of Submission 2022-02-10, 23:59 IST
Complete the code segment to call the method  print() of class Student first and then call print() method of class School.

NOTE: Don't provide any INPUT in Sample Test Cases


// This is the class named School
class School { 
    // This is a method in class School
    public void print() { 
        System.out.println("Hi! I class SCHOOL."); 
    } 
// This is the class named Student
class Student { 
    // This is a method in class Student
    public void print() { 
        System.out.println("Hi! I am class STUDENT"); 
    } 
}
public class Question21{ 
    public static void main(String args[]){

 

 



Week 2 : Programming Assignment 2

Due Date of Submission 2022-02-10, 23:59 IST
Complete the code segment to call the method  print() of class given class Printer to print the following.

--------------------------------
Hi! I am class STUDENT
Hi! I class SCHOOL.
--------------------------------

NOTE: Don't provide any INPUT in Sample Test Cases


// This is the class named Printer
class Printer { 
    // This are the methods in class Printer
    public void print() { 
System.out.println("Hi! I class SCHOOL."); 
    } 
    public void print(String s) { 
System.out.println(s); 
    } 

public class Question22{ 
    public static void main(String[] args) {

 

 



Week 2 : Programming Assignment 3

Due Date of Submission 2022-02-10, 23:59 IST
Complete the code segment to call print() method of class Question by creating a method named ‘studentMethod()’.

// This is the main class Question
public class Question23{ 
    public static void main(String[] args) { 
// Object of the main class is created
Question23 q = new Question23();
// Print method on object of Question class is called
q.studentMethod();
    }

// 'print()' method is defined in class Question
void print(Question23 object){
System.out.print("Well Done!");
}

 

 



Week 2 : Programming Assignment 4

Due Date of Submission 2022-02-10, 23:59 IST
Complete the code segment to call default constructor first and then any other constructor in the class.

// This is the main class Question
public class Question214{
public static void main(String[] args){
Answer a = new Answer(10,"MCQ");
}
}

 

 



Week 2 : Programming Assignment 5

Due Date of Submission 2022-02-10, 23:59 IST
Complete the code segment to debug / complete the program which is intended to print 'NPTEL JAVA'.

public class Question215{ 
    public static void main(String[] args) { 

 

 


Post a Comment (0)
Previous Post Next Post