Professional Documents
Culture Documents
PROGRAMMING
CS4001NP
Coursework 1
Group: C4 Programming
• It is used for developing Android Apps. It helps you to make Enterprise Software.
• It has wide selection of Mobile java applications
• It is a Scientific Computing Applications
• It is used for giant Data Analytics
• it's used for Java Programming of Hardware devices
• it's used for Server-Side Technologies like Apache, JBoss, GlassFish, etc. (Guru99, 2021)
Figure 1 JAVA
1
2. Class Diagram
Course
-courseID: String
-courseName: String
-duration: int
-courseLeader: String
AcademicCourse NonAcademicCourse
-LecturerName: String -InstructorName: String
-Level: String -StartDate: String
-Credit:String -CompletionDate: String
-StartingDate: String -ExamDate: String
-CompletionDate: String -prerequisite: String
-NumberOfAssessments: double -isRegistered: boolean
-isRegistered: boolean -isRemoved: boolean
2
+AcademicCourse(duration:int +NonAcademicCourse(courseID:
,courseName: String, duration: int, String, courseName: String, duration:
prerequisite: String): void int, prerequisite: String
+getlecturers(): String +getinstructorName(): String
+getlevel(): String +getduration(): double
+getcredit(): String +getstartDate(): String
+getstartingDate(): String +getcompletionDate(): String
+completionDate(): String +getexamDate(): String
+getnumberOfAssessments(): double +getprerequisite(): String
+getIsRegistered(): boolean +getIsRegistered(): boolean
+setlecturers(): String +getIsRemoved(): boolean
+registerAcademicCourse(CourseLeader:
String, lecturers: String, startingDate:
String, completionDate: String):void
+displayDetailsOfCourse():void
3. Pseudocode
Pseudocode is an off-the-cuff way of programming description that doesn't require any strict
programing language syntax or underlying technology considerations. it's used for creating an
overview or a rough draft of a program.
CALL course (int duration, String courseID, String coursename, String courseLeader)
this.courseID=courseID;
this.courseName=courseName;
3
this.duration=duration;
courseLeader=””
END DO
DO return CourseID
END DO
DO return CourseName
END DO
Do return duration
END DO
DO return courseLeader
END DO
DO
this.courseLeader=CourseLeader
END DO
CALL display()
DO
DO
END DO
4
END IF
5
END DO
CALL String getlevel()
DO
Return Level
END DO
CALL String getCredit()
DO
Return Credit
END DO
CALL String getstaringDate()
DO
Return StartingDate
END DO
CALL String getcompletionDate()
DO
Return CompletionDate
END DO
CALL double getnumberOfAssessments()
DO
Return NumberOfAssessments
END DO
CALL boolean getIsRegistered()
DO
Return isRegistered
END DO
CALL setlecturers(String lecturers)
DO
6
LecturerName=lecturers
END DO
CALL setnumberOfAssessments(double numberOfAssessments)
numberOfAssessments= numberOfAssessments
END DO
CALL registerAcademicCourse(String CourseLeader, String lecturers,String startingDate,
String completionDate)
DO
IF(isRegistered==true)
DO
OUTPUT(“The course has been registered and the lecturer name is ” +getlecturers())
OUTPUT(“The starting date of course is ”+getstartingDate() )
OUTPUT(“The completion date of academic course is ”+getcompletionDate())
END DO
ELSE
DO
Super.setCourseLeader(CourseLeader)
LecturerName=lecturers
StartingDate=startingDate
CompletionDate=completionDate
isRegistered=true
END DO
END IF
END DO
CALL display DetailsOfCourse()
DO
super.display()
7
IF(isRegistered==true)
DO
OUTPUT(“Name of the lecturer is ”+getlecturers())
OUTPUT(“Level of academic course is ”+getlevel())
OUTPUT(“Credit of academic course is ”+getcredit())
OUTPUT(“Starting date of academic course is ”+getstartingDate())
OUTPUT(“Completion date of academic course is ”+getcompletionDate())
OUTPUT(“No of assessments is ”+getnumberOfAssessments())
END DO
END
8
this.ExamDate=””
this.isRegistered=””
this.isRemoved=””
END DO
CALL String getinstructorName()
DO
Return InstructorName
END DO
CALL String getstartDate()
DO
Return StartDate
END DO
CALL String getCompletionsDate()
DO
Return completionDate
END DO
CALL String getexamDate()
DO
Return ExamDate
END DO
CALL String getPrerequisite()
DO
Return prerequisite
END DO
CALL boolean getIsRegistered()
DO
Return isRegistered
9
END DO
CALL boolean getIsRemoved()
DO
Return isRemoved
END DO
CALL setinstructorName(String instructorName)
DO
IF(isRegistered==false)
DO
this.InstructorName=instructorName
END DO
ELSE
DO
OUTPUT(“The course is already register”)
END DO
END DO
DO
IF(isRegistered==false)
DO
setinstructorName(instructorName)
setCourseLeader(CourseLeader)
isRegistered==true
END DO
ELSE
DO
10
END DO
this.StartDate=startDate
this.completionDate=CompletionsDate
this.ExamDate=examDate;
END DO
DO
IF(isRemoved==true)
DO
END DO
ELSE
DO
setCourseLeader(courseLeader)
this.InstructorName=””
this.StartDate=””
this.completionDate=””
this.ExamDate=””
this.isRegistered=false
this.isRemoved=true
END DO
END DO
CALL displayDetailsOfNonAcademicCourse()
DO
super.display()
IF(isRegistered==true)
DO
11
OUTPUT(“Start Date of non academic course is ”+getstartDate())
END DO
END IF
END
4. Description of Methods
There are two method used in this coursework i.e getter and setter method. Getter method
is also known as the accessor method and Setter method is also known as mutator method.
Beside these two methods, display method is also used. The description of the method used
in this coursework are as follows:
12
• getIsRegistered(): This method is used to return the registration of the academic
course.
• setlecturers(String lecturers): This method is used to set the name of the lecturer
to a new lecturer name.
• setnumberOfAssessments(double numberOfAssessments): This method is used
to set the assessment number to a new assessment number.
• Void registerAcademicCourse(String CourseLeader, String lecturers, String
startingDate, String completionDate): This method takes four parameters. If the
course has joined a suitable message including lecturer name, starting date,
completion date is displayed. If not then it assigns the values of lecturer name,
staring date, completion date. It also changes the isRegistered status to true.
• Void displayDetailsOfCourses(): This method calls the Course class and displays
its details. If isRegistered status is true then it prints the details of the course
including lecturer name, level, credit, starting date, completion date and number
of assessments.
13
has not registered then instructor name and course leader is set . If not then
suitable message is display.
• Void removeCourse(): This is the remove method. If the isRemoved is true
then suitable message is display. If not then set CourseLeader from the parent
class
• Void display DetailsOfNonAcademicCourse(): If the non academic course is
registered then it is true then instructor name, starting date, completion date,
exam date is displayed.
5. Testing
Testing is the way to detect the error and solve it. Testing in the programming is one of the
important parts of development of the program. Here is the testing of the program of our
coursework:
Tests Objectives
1 Inspect AcademicCourse class,register an
academic course and re-inspect
theAcademicCourseCourse
2 Inspect NonAcademicCourse class,register a
non-academic course and re-inspect the
NonAcademicCourse class
3 Inspect NonAcademicCourse class again,
change the status of isTerminated to true and
re-inspect the NonAcademicCourse class
4 Display the detail of AcademicCourse and
NonAcademicCourse classes
Table 1Testing table
5.1 Test 1:
14
• Create an object the register with
parameter values as asked
• Re-inspect the AcademicCourse Class
Expected Result All the passed values were expected to be
seen while inspecting and re-inspecting
Actual Result All the values passed in the parameter were
shown while inspecting and re-inspecting
Conclusion The test was successful.
Table 2 Test 1
15
➢ Input the information of Course duration, course name level, Credit and Number of
assessments
Figure 3 Input the information of Course duration, course name level, Credit and Number of assessments
16
➢ Calling the register method.
Figure 6 Input the information of CourseLeader, lecturerName, Starting Date and completion Date
17
➢ Re-inspecting Academic Course
5.2 Test 2
18
➢ Creating Object for the class NonAcademicCourse
➢ Input all the information of Course duration, courseID, coursename and prerequisite
Figure 9 Input all the information of Course duration, courseID, coursename and prerequisite
19
➢ Inspect NonAcademicCourse Class
20
➢ Input the information of CourseLeader, instructorName, startDate, completionDate,
examDate.
21
➢ Re-inspecting NonAcademicCourse class
5.3 Test 3
22
➢ Creating the object of NonAcademicCourse Class
Figure 15 Input the information of course duration, courseID, coursename and prerequisite.
23
➢ Inspect NonAcademicCourse Class
24
➢ Re-inspect NonAcademicCourse Class
5.4 Test 4
25
Academic Course
➢ Input all the information of duration, courseID, courseName, level, Credit and
NumberofAssessments.
Figure 19 Input all the information of duration, courseID, courseName, level, Credit and NumberofAssessments.
26
➢ Displaying the information after object creation of AcademicCourse Class
Figure 22 Input the information of CourseLeader, lecturers,startingDate and completionDate of AcademicCourse Class
27
➢ Displaying the information after calling register method of AcademicCourse Class
Figure 23 Displaying the information after calling register method of AcademicCourse Class
28
➢ Input the information of CourseLeader, instructorName, startDate, completionDate,
examDate of NonAcademicCourse Class
29
➢ Displaying the information after calling register method of NonAcademicCourse Class
Figure 28 Displaying the information after calling register method of NonAcademicCourse Class
30
➢ Calling display method after calling remove method of NonAcademicCourse Class
Figure 30 Calling display method after calling remove method of NonAcademicCourse Class
Figure 31 Displaying the information after calling remove method of NonAcademicCourse Class
31
6. Error and Correction:
During doing programming for the coursework, I have face many errors and programming
is not compile and run. Some of the error that I have faced during doing programming are
mentioned below:
In the above figure, an error is occur while calling super class display method in the child class
NonAcademicCourse. The error was that to call super class, I forget to add full stop(.) after
super. As we can see the complier show undeclared method. To correct that error add full
stop(.) in between the super and display.
32
In the figure above, there is the data type error in the parameterized constructor. I have
forget to write data type in the parameter constructor which show syntax error by the
complier. To correct that error, write the data type in the parameter constructor.
33
Figure 36 Logical Error:
Logical error is the your program compiles and runs, but does the wrong thing. While
doing programming, the complier doesnot show syntax error but when I wiite the value
of ExamDate then the complier shows empty string as show in figure above.
34
6.6 Correction of Logical Error
35
Figure 37 Correction of Logical Error
36
Figure 39 Correction of Symmetric Error.
You can see a semantic error when the syntax of your code is correct but the code usage isn't
correct. The most common semantic error is one in which the code uses a variable that isn't
initialized properly. In the Figure above I forget to write the String value inside the double
coded i.e. (‘’ “). Due to this, the complier show error and doesnot except the values.
37
7. Conclusion
It was the first coursework of Java Programming given by the Sushil Poudel Sir. There was
an almost 3 weeks given to complete the coursework. I have done so many researches to
complete the coursework. When the module course started, I am new in Java programming
and it is difficult to understand the programming. But now it is better to understand java
programming.
This coursework helps me a lot to understand about java programming. During research, I
have got so many knowledge and information related to java programming. The main of the
program is to develop three classes named Courses as parent class and Academic course
and nonacademic course as child class and hence develop the program with the help of
inheritance. I have also gotten the knowledge related to Getter and Setter method where
Getter method return the value and Setter method set the new value.
This coursework is not easy task for me. I have done hard work and effort to complete this
coursework. While doing this coursework I have learnt to manage the time according to
situation. The lecture slides provided to us by the teachers helped us tons for the
completion of the report. The challenging coursework was completed with many testings
and error solving. All those errors encountered during the coursework were solved by the
study of varied studying materials which helped to enhance my learning and skills in
programming. So overall the coursework was interesting and has helped within the
development of program.
8. Bibliography
Guru99. (2021, March 30). What is Java? Definition, Meaning & Features of Java Platforms. Retrieved
from www.guru99.com: https://www.guru99.com/java-platform.html
38
9. Appendix
The code of our program coursework is given below:
39
this.duration=duration;
courseLeader="";
}
/**
* Below there is a Getter method for each attributes.
*/
public String getCourseID()//Getter method for courseID
{
return courseID;
}
public String getCourseName()//Getter method for courseName
{
return courseName;
}
public int getDuration()//Getter method for duration
{
return duration;
}
public String getCourseLeader()//Getter method for courseLeader
{
return courseLeader;
}
40
/**
* Setter method set the new value to the parameter.
* Setter method for the courseLeader attribute set new value to the parameter.
*/
public void display()
/**
* Display method display the details of courseID, courseName, duration attributes
*/
{
System.out.println("The ID of the course is"+getCourseID());
System.out.println("The name of the course is"+getCourseName());
System.out.println("The time to complete this course is"+getDuration());
if(!courseLeader.isEmpty())
{
System.out.println("The name of the course leader is"+getCourseLeader());//Printing
course leader name of name is not null
}
}
}
41
* There is one attribute which store 1 boolean value.
* @author (Anjal Mahato)
* @london met ID (20048637)
* @version(a version number or a date)
*/
42
this.NumberOfAssessments=NumberOfAssessments;
this.LecturerName="";
this.StartingDate="";
this.CompletionDate="";
this.isRegistered=false;
}
/**
* Below are the Getter Method of AcademicCourse that return value.
*/
public String getlecturers(){ //Getter method for LecturerName
return LecturerName;
}
public String getlevel(){ //Gettter method for Level
return Level;
}
public String getcredit(){ // Getter method for Credit
return Credit;
}
public String getstartingDate(){// Getter method for StartingDate
return StartingDate;
}
public String getcompletionDate(){//Getter method for CompletionDate
return CompletionDate;
}
public double getnumberOfAssessments(){//Getter method for NumberOfAssessments
return NumberOfAssessments;
}
43
public boolean getIsRegistered(){//Getter method for isRegistered
return isRegistered;
}
public void setlecturers(String lecturers){//Setter method for LecturerName
LecturerName=lecturers;
}
/**
* Setter method for the LecturerName as lecturers where setter method set new value to
parameter
*/
public void setnumberOfAssessments(double numberOfAssessments){//Setter method for
NumberOfAssessments
NumberOfAssessments=numberOfAssessments;
}
/**
* Setter method for NumberOfAssessments as numberOfAssessments that set new value
to the parameter
*/
public void registerAcademicCourse(String CourseLeader, String lecturers, String
startingDate, String completionDate)
/**
* This is the void method that donot return the value
* It works in if condition
*/
{
if(isRegistered==true){
System.out.println("The course has been registered and the lecturer name is"
+getlecturers());
System.out.println("The starting date of course is"+getstartingDate());
44
System.out.println("The date when course is completed is "+getcompletionDate());
}
else{
super.setCourseLeader(CourseLeader);//Calling CourseLeader from the parent class
LecturerName=lecturers;
StartingDate=startingDate;
CompletionDate=completionDate;
isRegistered=true;
}
}
public void displayDetailsOfCourse()
/**
* This the void method.
* This method display the details of Lecturer, level, credit, starting date, completion date
and number of assessments of academic course
*/
{
super.display();//Display courseName, courseID, duration of the parent class i.e. Course
class
if(isRegistered==true){
System.out.println("The name of the lecturer is"+getlecturers());
System.out.println("The level of academic course is"+getlevel());
System.out.println("The credit of the academic course is"+getcredit());
System.out.println("The starting date of academic course is"+getstartingDate());
System.out.println("The completion date of the academic course
is"+getcompletionDate());
System.out.println("The number of assesssments is"+getnumberOfAssessments());
45
}
}
}
46
super(duration,courseID,coursename);//Calling duration, courseID and coursename from
parent class Course
this.prerequisite=prerequisite;
this.InstructorName="";
this.StartDate="";
this.completionDate="";
this.ExamDate="";
this.isRegistered=false;
this.isRemoved=false;
}
/**
* Making of return type of Getter Method
* 7 getter or accessor method.
* 5 method return String data
* 2 method return boolean data
*/
public String getinstructorName()//Getter method for InstructorName
{
return InstructorName;
}
47
return completionDate;
}
public String getexamDate()//Getter method for examDate
{
return ExamDate;
}
public String getPrerequisite()//Getter method for prerequisite
{
return prerequisite;
}
public boolean getIsRegistered()//Getter method for isRegistered
{
return isRegistered;
}
public boolean getIsRemoved()//Getter method for isRemoved
{
return isRemoved;
}
public void setinstructorName(String instructorName)
/**
* This is the non return or void type method
* it works with if else condition
*/
{
if(isRegistered==false)
48
{
this.InstructorName=instructorName;
}
else{
System.out.println("The course is already register");
}
}
this.StartDate=startDate;
49
this.completionDate=CompletionsDate;
this.ExamDate=examDate;
}
public void removeCourse()
/**
* it is a void method that doesnot return the value
* it works in if else condition wheather condition is true or false
*/
{
if(isRemoved==true)//Display the message if isRemoved is false
{
System.out.println("The course has been removed!");
}
else{
setCourseLeader(courseLeader);
this.InstructorName="";
this.StartDate="";
this.completionDate="";
this.ExamDate="";
this.isRegistered=false;
this.isRemoved=true;
}
}
public void displayDetailsOfNonAcademicCourse()
/**
50
* This the void method that doesnot return the value
* Display the details of non academic course if the value is true
*/
{
super.display();//calling the display method from parent class
if(isRegistered==true)//Display if isRegistered is true
{
51