0% found this document useful (0 votes)
14 views

Noc20-Cs08 Week 04 Assignment 03

Uploaded by

madhanlap0402
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)
14 views

Noc20-Cs08 Week 04 Assignment 03

Uploaded by

madhanlap0402
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/ 3

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: Q2
Course Due on 2020-02-27, 23:59 IST
outline
Complete the code segment to print the current year. Your code should compile
successfully.
How does an Note: 1) In this program, you are not allowed to use any import statement.
NPTEL online 2) Use should use predefined class Calendar defined in java.util package and
course work? name its object as current.
3) No Public Test Case is given.
Week 0 :
Sample Test Cases
Week 1 : Input Output

Current Year: 2020


Week 2 : Test Case 1
Current Month: 2

Week 3 :
The due date for submitting this assignment has passed.
Week 4 : As per our records you have not submitted this assignment.
Sample solutions (Provided by instructor)
Lecture 16 :
1 // The following is the declaration of the main class named Question42
Demonstration- 2 public class Question42 {
VII (unit? 3 public static void main(String args[]){
unit=5&lesson=30) 4 int year; // integer type variable to store year
5
6 // Create an object of Calendar class.
Lecture 17 : 7 java.util.Calendar current;
Packages-I 8
(unit? 9 // Use getInstance() method to initialize the Calendar o
10 current = java.util.Calendar.getInstance();
unit=5&lesson=31) 11
12 // Initialize the int variable year with the current year
Lecture 18 : 13 year = current.get(current.YEAR);
Packages-II 14
15 // Print the current Year
(unit? 16 System.out.println("Current Year: "+year);
unit=5&lesson=32) 17
18 //int month = current.get(current.MONTH);
Lecture 19 : 19 System.out.print("Current Month: "+ 2);
Demonstration-
20
21

https://onlinecourses.nptel.ac.in/noc20_cs08/progassignment?name=126 1/3
02/07/2020 Programming in Java - Course

VIII (unit? 22 }
unit=5&lesson=33) 23 }
24
Lecture 20 :
Interface-I
(unit?
unit=5&lesson=34)

Quiz :
Assignment 4
(assessment?
name=96)

Java Week 4:
Q1
(/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=126 2/3
02/07/2020 Programming in Java - Course

Assignment
Solution

Books

Live Interactive
Session

https://onlinecourses.nptel.ac.in/noc20_cs08/progassignment?name=126 3/3

You might also like