Couse code : 22EBCP205 Course : DevOps Lab
DevOps Assignment – 2
Branching Concept
1. Create a Student class and write the functions for the following:
1. Display Student Name.
2. Display age of student, by accepting date of birth as parameter(DD-
MM-YYYY or YYYY-MM-DD) using "Date" Class
The above code should be pushed to new GitHub repository for "main"
branch.
------------------------------------------------------------------------------------------
Source code :
import [Link];
import [Link];
import [Link];
public class Student_Details {
public static void main(String[] args) {
Scanner scanner = new Scanner([Link]);
[Link]("Enter candidate name : ");
String student_name = [Link]();
[Link]("Enter date of birth (YYYY-MM-DD) : ");
String input_dob = [Link]();
Student_Details student1 = new Student_Details();
[Link]("Details of student are : ");
student1.display_student_name(student_name);
student1.display_student_DOB(input_dob);
[Link]();
}
KLE Tech, Hubli Department of Computer Application
Couse code : 22EBCP205 Course : DevOps Lab
public void display_student_name(String name) {
[Link]("Student name : " + name);
}
public void display_student_DOB(String date) {
LocalDate dob = [Link](date);
[Link]("Student age : " + calculateAge(dob));
}
public static int calculateAge(LocalDate dob) {
LocalDate curDate = [Link]();
// calculates the amount of time between two dates and returns the
years
if ((dob != null) && (curDate != null)) {
return [Link](dob, curDate).getYears();
} else {
return 0;
}
}
}
Output :
KLE Tech, Hubli Department of Computer Application
Couse code : 22EBCP205 Course : DevOps Lab
Creating new repository :
Git commands :
KLE Tech, Hubli Department of Computer Application
Couse code : 22EBCP205 Course : DevOps Lab
Updated git repository :
KLE Tech, Hubli Department of Computer Application
Couse code : 22EBCP205 Course : DevOps Lab
2. Create a class to display the courses of respective semester and marks
obtained for each course. The same must be pushed to be new branch
"student_course_information", once the functionalities of "Student" and
"StudentCourses" class are executed successfully, the new branch should
be merged to the "main" branch.
------------------------------------------------------------------------------------------
Source code :
public class Student {
public static void main(String[] args) {
StudentCourses student01 = new StudentCourses(“Dhruva", 248);
student01.semester01(93, 82);
student01.semester02(90, 85);
student01.semester03(92,94);
}
}
class StudentCourses extends Student{
String student_name;
int student_usn;
public StudentCourses(String name, int usn){
this.student_name = name;
this.student_usn = usn;
display_details();
}
public void display_details(){
[Link]("Student name : "+ student_name);
KLE Tech, Hubli Department of Computer Application
Couse code : 22EBCP205 Course : DevOps Lab
[Link]("Student USN : "+ student_usn);
}
public void semester01(int C_Programming, int wed_Technology){
[Link]("First semester courses and mark :- ");
// int C_Programming = 93;
// int wed_Technology = 82;
[Link]("i. C Programming : "+ C_Programming);
[Link]("ii. Wed Technology : "+ wed_Technology);
}
public void semester02(int Cpp_Programming, int FCO){
[Link]("Second semester courses and mark :- ");
// int Cpp_Programming = 90;
// int FCO = 85;
[Link]("i. C++ Programming : "+ Cpp_Programming);
[Link]("ii. FCO : "+ FCO);
}
public void semester03(int applied_statistics, int
computer_networking){
[Link]("Third semester courses and mark :-");
// int applied_statistics = 92;
// int computer_networking = 94;
[Link]("i. Applied Statistics : "+ applied_statistics);
[Link]("ii. Computer Networking : "+
computer_networking); } }
Output :
KLE Tech, Hubli Department of Computer Application
Couse code : 22EBCP205 Course : DevOps Lab
Git commands :
Creating new branch :
KLE Tech, Hubli Department of Computer Application
Couse code : 22EBCP205 Course : DevOps Lab
Updated git repository :
KLE Tech, Hubli Department of Computer Application
Couse code : 22EBCP205 Course : DevOps Lab
KLE Tech, Hubli Department of Computer Application
Couse code : 22EBCP205 Course : DevOps Lab
KLE Tech, Hubli Department of Computer Application
Couse code : 22EBCP205 Course : DevOps Lab
KLE Tech, Hubli Department of Computer Application