The document outlines a series of practical exercises for a Computer Science course focused on Object-Oriented Java programming. Each practical includes a title, aim, required equipment, theoretical background, procedures, observations, results, conclusions, and exercises related to various Java programming concepts such as data types, control structures, and event handling. Students are expected to document their findings and demonstrate their understanding through practical application and exercises.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
3 views19 pages
COM 121 OO Java Practical Manual
The document outlines a series of practical exercises for a Computer Science course focused on Object-Oriented Java programming. Each practical includes a title, aim, required equipment, theoretical background, procedures, observations, results, conclusions, and exercises related to various Java programming concepts such as data types, control structures, and event handling. Students are expected to document their findings and demonstrate their understanding through practical application and exercises.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 19
FEDERAL POLYTECHNIC, BAUCHI
COMPUTER SCIENCE DEPARTMENT
COM 121
OBJECT ORIENTED JAVA
PRACTICAL
GROUP NAME
<LIST OF NAMES AND MATRIC. NUMBER OF MEMBERS>
PRACTICAL 1 Laboratory: - Student should indicate where the practical is conducted (name of the laboratory). Title: - Running and compilation of Java program. Aim: - Aim of the practical is to demonstrate how to write, compile and run Java Program using Notepad and JSDK. Equipment Required: - 1. Computer System with JSDK and notepad text editor. 2. Plain paper for rough work. 3. Network Printer to print result. Theory: - Students are to read from textbooks and internet the surrounding theories behind the practical and summaries these theories under this section. Procedure:- 1. Using notepad write a simple Java program to display your names and course of study, save in the bin folder of JSDK. 2. Using command prompt compile the program and run it. 3. Screenshot result.. Observation: - Student should carefully document all the necessary observations they have made during the practical, under this section. Students should bear in mind that only observations leading to results are needed. Example is flag settings change during executing an assembling assembly language program. Result: - The final result obtained from the practical should be shown here; where result is lengthy it can be attached as appendix and referred from this section. Screen captured of runtime are better form of showing programming result than typing the result manually in word processor. Conclusion: - Students should clearly indicate whether or not the aim of the practical has been achieved, and where it has not been achieved, reasons should be given. Exercise: - 1. What are the differences in compiling Java Program in windows and in Linux. 2. Enumerate standard input/output and GUI one. PRACTICAL 2 Laboratory: - Student should indicate where the practical is conducted (name of the laboratory). Title: - Evaluating Arithmetic Operations. Aim: - Aim of the practical is to demonstrate how to write Java program to use addition, subtraction, division, multiplication and modulus operators. Equipment Required: - 1. Computer System with JSDK and notepad text editor. 2. Plain paper for rough work. 3. Network Printer to print result. Theory: - Students are to read from textbooks and internet the surrounding theories behind the practical and summaries these theories under this section. Procedure:- 1. Using notepad write a simple Java program to add, subtract, divide, multiply and reminder operation on two numbers stored in variables. 2. Repeat the procedure with the two numbers inputted after runtime 3. Screenshot result.. Observation: - Student should carefully document all the necessary observations they have made during the practical, under this section. Students should bear in mind that only observations leading to results are needed. Example is flag settings change during executing an assembling assembly language program. Result: - The final result obtained from the practical should be shown here; where result is lengthy it can be attached as appendix and referred from this section. Screen captured of runtime are better form of showing programming result than typing the result manually in word processor. Conclusion: - Students should clearly indicate whether or not the aim of the practical has been achieved, and where it has not been achieved, reasons should be given. Exercise: - 3. Discuss Java data types. 4. Enumerate operator precedence in Java. PRACTICAL 3 Laboratory: - Student should indicate where the practical is conducted (name of the laboratory). Title: - Use of different variables and data types. Aim: - Aim of the practical is to demonstrate how to write Java program to store values in variables of different data types. Equipment Required: - 1. Computer System with JSDK and notepad text editor. 2. Plain paper for rough work. 3. Network Printer to print result. Theory: - Students are to read from textbooks and internet the surrounding theories behind the practical and summaries these theories under this section. Procedure:- 1. Using notepad write a simple Java program to receive and store integer, float, character, string and Boolean values to variables. 2. Display these values on runtime 3. Screenshot result.. Observation: - Student should carefully document all the necessary observations they have made during the practical, under this section. Students should bear in mind that only observations leading to results are needed. Example is flag settings change during executing an assembling assembly language program. Result: - The final result obtained from the practical should be shown here; where result is lengthy it can be attached as appendix and referred from this section. Screen captured of runtime are better form of showing programming result than typing the result manually in word processor. Conclusion: - Students should clearly indicate whether or not the aim of the practical has been achieved, and where it has not been achieved, reasons should be given. Exercise: - 1. Discuss primitive and composite data type in Java. 2. Enumerate how to minimize mismatch errors in a program. PRACTICAL 4 Laboratory: - Student should indicate where the practical is conducted (name of the laboratory).
Title: - Data Type Casting.
Aim: - Aim of the practical is to demonstrate how to write Java program and receive data in one form and convert it into another form. Equipment Required: - 1. Computer System with JSDK and notepad text editor. 2. Plain paper for rough work. 3. Network Printer to print result. Theory: - Students are to read from textbooks and internet the surrounding theories behind the practical and summaries these theories under this section. Procedure:- 1. Using notepad write a simple Java program to receive different data in one data type and convert them to another data type then store them into variable.. 2. Display these values on runtime 3. Screenshot result.. Observation: - Student should carefully document all the necessary observations they have made during the practical, under this section. Students should bear in mind that only observations leading to results are needed. Example is flag settings change during executing an assembling assembly language program. Result: - The final result obtained from the practical should be shown here; where result is lengthy it can be attached as appendix and referred from this section. Screen captured of runtime are better form of showing programming result than typing the result manually in word processor. Conclusion: - Students should clearly indicate whether or not the aim of the practical has been achieved, and where it has not been achieved, reasons should be given. Exercise: - 3. Discuss data typecasting in Java. 4. Using example demonstrate how integer data can be converted to float and vice versa. PRACTICAL 5 Laboratory: - Student should indicate where the practical is conducted (name of the laboratory).
Title: - Control Structure (If..else).
Aim: - Aim of the practical is to demonstrate how to write Java program with control structure. Equipment Required: - 1. Computer System with JSDK and notepad text editor. 2. Plain paper for rough work. 3. Network Printer to print result. Theory: - Students are to read from textbooks and internet the surrounding theories behind the practical and summaries these theories under this section. Procedure:- 1. Using notepad write a simple Java program to receive student CA and exams and using IF statement find out the student’s grade (Use Polytechnic grading system). 2. Display these values on runtime 3. Screenshot result. Observation: - Student should carefully document all the necessary observations they have made during the practical, under this section. Students should bear in mind that only observations leading to results are needed. Example is flag settings change during executing an assembling assembly language program. Result: - The final result obtained from the practical should be shown here; where result is lengthy it can be attached as appendix and referred from this section. Screen captured of runtime are better form of showing programming result than typing the result manually in word processor. Conclusion: - Students should clearly indicate whether or not the aim of the practical has been achieved, and where it has not been achieved, reasons should be given. Exercise: - 1. What is nested if statement hence what is its maximum limit in Java. 2. Discuss control structure to handle more than two options in Java. PRACTICAL 6 Laboratory: - Student should indicate where the practical is conducted (name of the laboratory).
Title: - Looping Structure (Do & While).
Aim: - Aim of the practical is to demonstrate how to write Java program with iteration. Equipment Required: - 1. Computer System with JSDK and notepad text editor. 2. Plain paper for rough work. 3. Network Printer to print result. Theory: - Students are to read from textbooks and internet the surrounding theories behind the practical and summaries these theories under this section. Procedure:- 1. Using notepad write a simple Java program to either compute factorial or Fibonacci series using any loop in Java. 2. Display these values on runtime 3. Screenshot result. Observation: - Student should carefully document all the necessary observations they have made during the practical, under this section. Students should bear in mind that only observations leading to results are needed. Example is flag settings change during executing an assembling assembly language program. Result: - The final result obtained from the practical should be shown here; where result is lengthy it can be attached as appendix and referred from this section. Screen captured of runtime are better form of showing programming result than typing the result manually in word processor. Conclusion: - Students should clearly indicate whether or not the aim of the practical has been achieved, and where it has not been achieved, reasons should be given. Exercise: - 1. With the aid of a Java program demonstrate and infinite loop. 2. Write Java program to display odd numbers 1 – 1,000. PRACTICAL 7 Laboratory: - Student should indicate where the practical is conducted (name of the laboratory).
Title: - String Manipulation.
Aim: - Aim of the practical is to demonstrate how to write Java to use charAT(), compareTo(), concat(), equals() and copyvalueOf() String classes. Equipment Required: - 1. Computer System with JSDK and notepad text editor. 2. Plain paper for rough work. 3. Network Printer to print result. Theory: - Students are to read from textbooks and internet the surrounding theories behind the practical and summaries these theories under this section. Procedure:- 1. Using notepad write a simple Java program to handle charAT(), compareTo(), concat(), equals() and copyvalueOf() String classes. 2. Display these values on runtime 3. Screenshot result. Observation: - Student should carefully document all the necessary observations they have made during the practical, under this section. Students should bear in mind that only observations leading to results are needed. Example is flag settings change during executing an assembling assembly language program. Result: - The final result obtained from the practical should be shown here; where result is lengthy it can be attached as appendix and referred from this section. Screen captured of runtime are better form of showing programming result than typing the result manually in word processor. Conclusion: - Students should clearly indicate whether or not the aim of the practical has been achieved, and where it has not been achieved, reasons should be given. Exercise: - 1. Discuss Java String classes. 2. Using example on each String class, write Java program to handle all the String classes of Java. PRACTICAL 8 Laboratory: - Student should indicate where the practical is conducted (name of the laboratory).
Title: - Array Handling.
Aim: - Aim of the practical is to demonstrate how to write Java to use both single dimensional array and multi dimensional array. Equipment Required: - 1. Computer System with JSDK and notepad text editor. 2. Plain paper for rough work. 3. Network Printer to print result. Theory: - Students are to read from textbooks and internet the surrounding theories behind the practical and summaries these theories under this section. Procedure:- 1. Using notepad write a simple Java program to create array of second semester of ND I Computer science and supply the courses then display them from the array. 2. Using notepad write a simple Java program to create array of 36 states and the state capital, supply values into the array and using search display name of state and its state capital when searched. 3. Screenshot results. Observation: - Student should carefully document all the necessary observations they have made during the practical, under this section. Students should bear in mind that only observations leading to results are needed. Example is flag settings change during executing an assembling assembly language program. Result: - The final result obtained from the practical should be shown here; where result is lengthy it can be attached as appendix and referred from this section. Screen captured of runtime are better form of showing programming result than typing the result manually in word processor. Conclusion: - Students should clearly indicate whether or not the aim of the practical has been achieved, and where it has not been achieved, reasons should be given. Exercise: - 1. Discuss foreach loop in Java. 2. Using example demonstrate how to use foreach loop of Java in a program. PRACTICAL 9 Laboratory: - Student should indicate where the practical is conducted (name of the laboratory).
Title: - Event driven.
Aim: - Aim of the practical is to demonstrate how to write Java to use event handling on text and button to create binary calculator with +,-,/ and *. Equipment Required: - 1. Computer System with JSDK and notepad text editor. 2. Plain paper for rough work. 3. Network Printer to print result. Theory: - Students are to read from textbooks and internet the surrounding theories behind the practical and summaries these theories under this section. Procedure:- 1. Using notepad design a calculator to handle binary operations on +, -, / and *. 2. Run test the calculator to produce results. 3. Screenshot results. Observation: - Student should carefully document all the necessary observations they have made during the practical, under this section. Students should bear in mind that only observations leading to results are needed. Example is flag settings change during executing an assembling assembly language program. Result: - The final result obtained from the practical should be shown here; where result is lengthy it can be attached as appendix and referred from this section. Screen captured of runtime are better form of showing programming result than typing the result manually in word processor. Conclusion: - Students should clearly indicate whether or not the aim of the practical has been achieved, and where it has not been achieved, reasons should be given. Exercise: - 1. Discuss event handling capabilities of Java. 2. Using example demonstrate event handling of Java on button, menuitem, textfield, textarea, checkbox, choice and list.