You are on page 1of 6

INFORMATION AND COMMUNICATION TECHNOLOGY

DEPARTMENT
SESSION : 1: 2021/2022
Vision:
“To be the Leading_Edge TVET
: DFC30133 - OBJECT ORIENTED
COURSE
Institution” PROGRAMMING
CONTINUOUS ASSESSMENT : CASE STUDY 1 Total Marks: 36

TOPIC 3:
3.2.6 Build java programs using variables, operators and Input/ Output
TOPIC 3.3.1 Explain selection statements in Java programs.
3.3.2 Explain looping statements in Java programs.

CLO1: Construct Object Oriented Programming concept and exception handling in


CLO
Java programming. (P4, PLO3)
REG.
NAME RABIATUL ADAWIYAH BINTI MAT JAMIL 03DDT20F1041
NUMBER

Table 1: Multidimentional Array Book’s Borrowers


Name [0] [1] [2]
Ali Web Designer's Idea Korean for Dummies Network Worrior
Abu Java Pocket Guide Java in a Nutshell C++ for Dummies

Instruction:

Kampung Kelubi Library is a library located in the rural area. Borrower is allowed to borrow
maximum of three (3) books from the library.
You are required to produce a Java program using Two-Dimensional Array to help the librarian
to key in the borrower’s name and the books accordingly. You may use following code in your
program.

Diagram 1: Entering Data into Array

1
Diagram 2: Reading Data from an Array

Example of output:

Submission:
Use this question paper as the cover. Your submission must include:
1. Report – Copy paste the Java coding and screen shot the output. Save the file as
.docx or .pdf
2. Java file (source code)

2
RUBRIC CASE STUDY 1

Excellence (4) Good (3) Fair (2) Poor (1-0)


Excellent in Class Good in Class Moderate in Class Poor in Class
Class declaration declaration declaration declaration
Variable and Data Excellent in Good in variable Moderate in Poor in variable
Type variable declaration declaration variable declaration declaration
Excellent in built Good in built Moderate in built Poor in built object
object in Java object in Java object in Java in Java program
Object program program program
2 Dimensional 2 Dimensional 2 Dimensional Wrong 2
2 Dimensional array declaration array declaration array declaration Dimensional array
array declaration follow the writing acceptable did not described or declaration
guideline. not descriptive
All input output Some input output Some input output There is syntax
Input Output
statement are statement is correct statement is error in input output
statement correct ambiguous statement
Looping statement Few inappropriate Several Looping statement
Looping is stylistically well written of looping inappropriate is poorly written
statement written statement written of looping
statement
Standards of Program is Few inappropriate Several Program is poorly
writing style stylistically well design choices (i.e. inappropriate written
Documentation/ designed. poor variable design choices (i.e.
Comment names, improper poor variable Most or all
Program is well indentation) names, improper documentation
documented Missing one indentation) missing
required comment Missing two or
more required
comments
Follow the time After time but on
Timeliness given same day
Late 1 day Late 2 or more day
Report
requirement Excellently
reported. All Include all Missing some Missing half of
1. Report requirement requirement requirement requirement
2. Fail .java included.

3
Report Format:

Coding:
/*
Name : Rabiatul Adawiyah binti Mat Jamil
Reg. Number : 03DDT20F1041
Class :DDT3A
Case Study 1
*/

import java.io.*;//import package

class BorrowBook //subclass declaration


{
String booktable[][] = new String[2][3]; //create array
String name, name1; //variable declaration

void insertData() throws IOException {//method insertTitle()


BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));//create BufferedReader object

System.out.print("***************************KG KELUBI LIBRARY***************************" +"\n");//display output


System.out.print(" Enter Borrower's Name : ");//display output
name = stdin.readLine();//user input
for (int i=0; i<1; i++) // looping statement
{
for (int j=0; j<3; j++) //for statement
{
System.out.print(" Enter Book Title " +(j + 1) +": ");//display output
booktable[i][j] = stdin.readLine();//user input
}//end of for statement
}//end of looping statement

System.out.print(" Enter Borrower's Name : ");//display output


name1 = stdin.readLine();//user input
for (int i=1; i<2; i++) // looping statement
{
for (int j=0; j<3; j++) //for statement
{
System.out.print(" Enter Book Title " +(j + 1) +": ");//display output
booktable[i][j] = stdin.readLine();//user input
}//end of for statement
}//end of loop statement
}//end of method insertTitle()

4
void display() //method displayTitle()
{
//display output
System.out.println("***********************************************************************");
System.out.println("\t\t Book Borrowing Table Kg Kelubi Library");
System.out.println("***********************************************************************");
System.out.print("Name" +"\t"+"Book 1" +"\t\t\t" +"Book 2" +"\t\t\t"+"Book 3" +"\n");

System.out.print(name);//display output
for (int i=0; i<1; i++) // looping statement
{
for (int j=0; j<3; j++) //for statement
{
System.out.print("\t" + booktable[i][j]);//display output
}//end of for statement
}//end of looping statement

System.out.print("\n");//display output

System.out.print(name1);//display output
for (int i=1; i<2; i++) // looping statement
{
for (int j=0; j<3; j++) //for statement
{
System.out.print("\t" + booktable[i][j]);//display output
}//end of for statement
}//end of looping statement

System.out.print("\n");//display output
}//end of method displayTitle()
}//end of class BorrowBook

public class CaseStudy { //Superclass


public static void main(String[] args) throws IOException //main method
{
BorrowBook b1 = new BorrowBook();//create object
b1.insertData();//calling object
b1.display();//calling object
}//end of main method
}//end of class CaseStudy

5
Output:

You might also like