02/07/2020 Programming in Java - Course
(https://swayam.gov.in) (https://swayam.gov.in/nc_details/NPTEL)
[email protected]
NPTEL (https://swayam.gov.in/explorer?ncCode=NPTEL) » Programming in Java (course)
Announcements (announcements)
About the Course (https://swayam.gov.in/nd1_noc20_cs08/preview) Ask a Question (forum)
Progress (student/home) Mentor (student/mentor)
Java Week 4: Q5
Course Due on 2020-02-27, 23:59 IST
outline
Modify the code segment to print the following output.
How does an -----------------OUTPUT-------------------
NPTEL online Circle: This is Shape1
course work? Circle: This is Shape2
-------------------------------------------------
Week 0 :
Sample Test Cases
Week 1 : Input Output
Circle: This is Shape1
Week 2 : Test Case 1
Circle: This is Shape2
Week 3 :
Circle: This is Shape1
Test Case 2
Circle: This is Shape2
Week 4 :
Lecture 16 :
The due date for submitting this assignment has passed.
Demonstration-
VII (unit? As per our records you have not submitted this assignment.
unit=5&lesson=30) Sample solutions (Provided by instructor)
1 // Interface ShapeX is created
Lecture 17 : 2 interface ShapeX {
Packages-I 3 public String base = "This is Shape1";
4 public void display1();
(unit? 5 }
unit=5&lesson=31) 6
7 // Interface ShapeY is created which extends ShapeX
Lecture 18 : 8 interface ShapeY extends ShapeX {
Packages-II
9 public String base = "This is Shape2";
10 public void display2();
(unit? 11 }
unit=5&lesson=32) 12
13 // Class ShapeG is created which implements ShapeY
Lecture 19 : 14 class ShapeG implements ShapeY {
15 public String base = "This is Shape3";
Demonstration- 16 //Overriding method in ShapeX interface
i i
https://onlinecourses.nptel.ac.in/noc20_cs08/progassignment?name=128 1/3
02/07/2020 Programming in Java - Course
VIII (unit? 17 public void display1() {
unit=5&lesson=33) 18 System.out.println("Circle: " + ShapeX.base);
19 }
20 // Overriding method in ShapeY interface
Lecture 20 : 21 public void display2() {
Interface-I 22 System.out.println("Circle: " + ShapeY.base);
(unit? 23 }
24 }
unit=5&lesson=34) 25
26 // Main class Question
Quiz : 27 public class Question45{
Assignment 4 28 public static void main(String[] args) {
29 //Object of class shapeG is created and display methods are called.
(assessment? 30 ShapeG circle = new ShapeG();
name=96) 31 circle.display1();
32 circle.display2();
Java Week 4: 33 }
Q1
34 }
35
(/noc20_cs08/progassignment?
name=125)
Java Week 4:
Q2
(/noc20_cs08/progassignment?
name=126)
Java Week 4:
Q3
(/noc20_cs08/progassignment?
name=127)
Java Week 4:
Q4
(/noc20_cs08/progassignment?
name=129)
Java Week 4:
Q5
(/noc20_cs08/progassignment?
name=128)
Feedback For
Week 4 (unit?
unit=5&lesson=130)
Week 5 :
Week 6 :
Week 7 :
Week 8 :
Week 9 :
Week 10 :
Week 11 :
Week 12 :
DOWNLOAD
VIDEOS
https://onlinecourses.nptel.ac.in/noc20_cs08/progassignment?name=128 2/3
02/07/2020 Programming in Java - Course
Assignment
Solution
Books
Live Interactive
Session
https://onlinecourses.nptel.ac.in/noc20_cs08/progassignment?name=128 3/3