Soalan Tugasan 1 (Assignment 1) boleh di dapati dari link berikut:-
Assignment 1
Tarikh hantar ialah :- 10/3/2016
2/29/2016
2/17/2016
BCS2233 OOP. LAB 18/2/2016
Algorithm
1. Write an algorithm (Flowchart or Pseudocode) which inputs a length in inches, and outputs its equivalent in centimeters (1 inch = 2.54 centimeters)
2. Write an algorithm (Flowchart or Pseudocode) to input temperature in Fahrenheit and output the corresponding temperature in Centigrade. The formula for conversion is as follows.
3. Write algorithm (Flowchart or Pseudocode) to find the perimeter and area of a rectangle
The perimeter and area of the rectangle are given by the following formulas:
perimeter = 2 * (length + width)
area = length * width
4. (Finding the number of minutes and hours) Write a program that prompts the users to enter a number of seconds (e.g 1000000) and displays the equivalent numbers of hours and equivalents numbers of minutes.
Here is a sample run:
Enter the number of seconds :1000000
1000000 seconds = 16666.67 minutes
1000000 seconds = 277.78 hours
Java Program
1.
import java.util.Scanner;
public class cuba2 {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int inch;
double cm;
inch =input.nextInt();
cm= inch * 2.54;
System.out.println(cm);
}
}
1. Write an algorithm (Flowchart or Pseudocode) which inputs a length in inches, and outputs its equivalent in centimeters (1 inch = 2.54 centimeters)
2. Write an algorithm (Flowchart or Pseudocode) to input temperature in Fahrenheit and output the corresponding temperature in Centigrade. The formula for conversion is as follows.
C= 5/9 x (F - 32)
The perimeter and area of the rectangle are given by the following formulas:
perimeter = 2 * (length + width)
area = length * width
4. (Finding the number of minutes and hours) Write a program that prompts the users to enter a number of seconds (e.g 1000000) and displays the equivalent numbers of hours and equivalents numbers of minutes.
Here is a sample run:
Enter the number of seconds :1000000
1000000 seconds = 16666.67 minutes
1000000 seconds = 277.78 hours
5. Write an algorithm (Flowchart and Pseudocode) that accepts a student’s numerical
grade, converts the numerical grade to an equivalent letter grade, and displays
the letter grade.
A student’s letter grade is
calculated according to the following schedule:
Numerical
grade
|
Letter
grade
|
90-100
|
A
|
80-89
|
B
|
70-79
|
C
|
60-69
|
D
|
0-59
|
F
|
Java Program
1.
import java.util.Scanner;
public class cuba2 {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int inch;
double cm;
inch =input.nextInt();
cm= inch * 2.54;
System.out.println(cm);
}
}
1/31/2016
BCS 2233 Object Oriented Programming
Berikut adalah bahan-bahan pengajaran untuk subjek BCS 2233 Object Oriented Programming.
1) 'Lesson Plan' / Rancangan Pengajaran (download)
2) Buku Rujukan Y. Daniel Liang, Introduction to Java™ Programming, Brief Version, 10 Edition. 2015. Pearson Education.
3) 'Power point slide' bagi buku di atas boleh di dapati dari sini. Jumlah "Chapter" yang tersedia adalah sebanyak 42 "Slide", namun hanya Chapter di bawah sahaja yang terlibat. Pelajar di sarankan untuk membawa bahan ini (samada buku atau slide yang di cetak) ke kelas.
Chapter 1 Introduction to Computers, Programs, and Java
Chapter 2 Elementary Programming
Chapter 3 Selections
Chapter 5 Loops
Chapter 6 Methods
Chapter 7 Single-Dimensional Arrays
Chapter 8 Multidimensional Arrays
Chapter 9 Objects and Classes
Chapter 10 Thinking in Objects
Chapter 12 Exception Handling and Text IO
1) 'Lesson Plan' / Rancangan Pengajaran (download)
2) Buku Rujukan Y. Daniel Liang, Introduction to Java™ Programming, Brief Version, 10 Edition. 2015. Pearson Education.
3) 'Power point slide' bagi buku di atas boleh di dapati dari sini. Jumlah "Chapter" yang tersedia adalah sebanyak 42 "Slide", namun hanya Chapter di bawah sahaja yang terlibat. Pelajar di sarankan untuk membawa bahan ini (samada buku atau slide yang di cetak) ke kelas.
Chapter 1 Introduction to Computers, Programs, and Java
Chapter 2 Elementary Programming
Chapter 3 Selections
Chapter 5 Loops
Chapter 6 Methods
Chapter 7 Single-Dimensional Arrays
Chapter 8 Multidimensional Arrays
Chapter 9 Objects and Classes
Chapter 10 Thinking in Objects
Chapter 12 Exception Handling and Text IO
Chapter 14 JavaFX Basics
4.1 JDK boleh di dapati dari link berikut:-
NetBean
Beberapa bahan seperti koding Java yang terdapat di dalam buku ini boleh di dapati daripada sumber berikut.
4. Perisian
Dua jenis Perisian yang perlu ada untuk membangunkan program Java iaitu Enjin Java (JDK) dan Editor untuk menulis program java seperti Jcreator atau Eclipse atau Netbean.
4. Perisian
Dua jenis Perisian yang perlu ada untuk membangunkan program Java iaitu Enjin Java (JDK) dan Editor untuk menulis program java seperti Jcreator atau Eclipse atau Netbean.
4.1 JDK boleh di dapati dari link berikut:-
http://java.sun.com/javase/downloads/index.jsp
JCreator http://www.jcreator.org/download.htm
Eclipse http://www.eclipse.org/downloads/packages/eclipse-ide-java-developers/mars1
Eclipse http://www.eclipse.org/downloads/packages/eclipse-ide-java-developers/mars1
NetBean
10/03/2015
DCT1083 OOP: Assignment 3
2)
Create a base class named Point
consisting of x and y data members representing point coordinates. From this
class, derive a class named Circle
with another data member named radius.
For this derived class, the x and y data members represent a circle’s centre
coordinates. The member method of the Point
class should consist of a constructor that set the value for x and y to 0, an
area() method that return 0, and distance()
method that returns the distance between two points, (x1,y1)
and (x2,y2), where
Additionally, the derived class
should has an overided method named area()
that return’s a circle area
Area = 3.14 x radius2.
Draw UML diagram for the class Point and class Circle.
Due date : 15/10/2015
9/16/2015
DCT1083 OOP: Makluman Assignment 2 dan Ujian 1
Assalamualaikum.
Tarikh hantar Assignment 2 adalah pada 23/9/2015.
Assignment 2 boleh di buat berkumpulan seperti Assignment 1.
Ujian 1 akan di buat pada 30/9/2015. Contoh Ujian 1 adalah seperti di bawah:-
1. Response to the following statements by circling either T (TRUE) or F (FALSE). [10M]
I. A computer includes both hardware and software. In general, hardware is the physical aspect of the computer that can be seen, and software is the invisible instructions that control the hardware and make it perform tasks.
II. The machine language is a set of primitive instructions built into every computer.
III. Assembly languages are English-like and easy to learn and program.
IV. A compiler is used to translate the High-level languages (source program) into a machine language program.
V. Java enables users to develop and deploy applications on the Internet for servers, desktop computers, and small hand-held devices.( T / F)
VI. Java is one of language that support object oriented programming. ( T / F)
VII. Object-oriented programming (OOP) is a popular programming approach that is replacing traditional procedural programming techniques. ( T / F)
VIII. Reserved words or keywords are words that have a specific meaning to the compiler and cannot be used for other purposes in the program. ( T / F)
IX. System.out.println is one of the pre-defined methods in Java. ( T / F)
X. The main method looks like this: ( T / F)
public static void main(String[] args) {
// Statements;
}
2. Match the following Statement / Name to its description. [9M]
No Statements Description
I. x = 1; i = i + 8
II. int x = 1; Addition
III. double radius; Declaring and Initializing
IV. final int SIZE = 3; Multiplication
V. + Assignment Statements
VI. * Keywords
VII. Char, class, const Preincrement
VIII. i += 8 Constants
IX. ++counter Declaring Variables
3. Give a brief explanation for the following question.
I. What is Programming? [2 marks]
II. What is Debugging? [2 marks]
III. What is the difference between a Constant and a Variable? [2 marks]
4. Which of the following are invalid identifiers, why? [5 marks]
I. DCIT
II. DCIT Students
III. $matric
IV. matric_number
V. 1stJAVAProgram
5. Show ‘Evaluation Tree’ for the following expressions: [4 marks]
I. 8 + 2 / 4
II. 6 * 2 + 3 % 2
III. 3 + 2 / 5 + -2 * 4
IV. 2 * (1 + -(3/4) / 2) * (2 - 6 % 3)
6. Evaluate the following Boolean expressions. The value for X,Y and Z are as follows:-
X=1;
Y=2;
Z=3;
I. XII. X<0 br="" nbsp="">III. ((XIV. ((XV. ! (X7. Write a java fragment for the following problems.
0. Write a for statement to print integer 1 to 20. [example]
int i;
For (i=1; i<=20; i++)
System.out.Println(i);
I. Write a for statement to print integer 1 to 10. [3 marks]
II. Write a while statement to print integer 1 to 10. [3 marks]
8. Write a an algorithm and a java program that displays the following table:-
(note that 1 kilogram is 2.2 pounds):
[10 marks]
Kilograms Pounds
1 2.2
3 6.6
...
100 220
0>
Tarikh hantar Assignment 2 adalah pada 23/9/2015.
Assignment 2 boleh di buat berkumpulan seperti Assignment 1.
Ujian 1 akan di buat pada 30/9/2015. Contoh Ujian 1 adalah seperti di bawah:-
1. Response to the following statements by circling either T (TRUE) or F (FALSE). [10M]
I. A computer includes both hardware and software. In general, hardware is the physical aspect of the computer that can be seen, and software is the invisible instructions that control the hardware and make it perform tasks.
II. The machine language is a set of primitive instructions built into every computer.
III. Assembly languages are English-like and easy to learn and program.
IV. A compiler is used to translate the High-level languages (source program) into a machine language program.
V. Java enables users to develop and deploy applications on the Internet for servers, desktop computers, and small hand-held devices.( T / F)
VI. Java is one of language that support object oriented programming. ( T / F)
VII. Object-oriented programming (OOP) is a popular programming approach that is replacing traditional procedural programming techniques. ( T / F)
VIII. Reserved words or keywords are words that have a specific meaning to the compiler and cannot be used for other purposes in the program. ( T / F)
IX. System.out.println is one of the pre-defined methods in Java. ( T / F)
X. The main method looks like this: ( T / F)
public static void main(String[] args) {
// Statements;
}
2. Match the following Statement / Name to its description. [9M]
No Statements Description
I. x = 1; i = i + 8
II. int x = 1; Addition
III. double radius; Declaring and Initializing
IV. final int SIZE = 3; Multiplication
V. + Assignment Statements
VI. * Keywords
VII. Char, class, const Preincrement
VIII. i += 8 Constants
IX. ++counter Declaring Variables
3. Give a brief explanation for the following question.
I. What is Programming? [2 marks]
II. What is Debugging? [2 marks]
III. What is the difference between a Constant and a Variable? [2 marks]
4. Which of the following are invalid identifiers, why? [5 marks]
I. DCIT
II. DCIT Students
III. $matric
IV. matric_number
V. 1stJAVAProgram
5. Show ‘Evaluation Tree’ for the following expressions: [4 marks]
I. 8 + 2 / 4
II. 6 * 2 + 3 % 2
III. 3 + 2 / 5 + -2 * 4
IV. 2 * (1 + -(3/4) / 2) * (2 - 6 % 3)
6. Evaluate the following Boolean expressions. The value for X,Y and Z are as follows:-
X=1;
Y=2;
Z=3;
I. X
0. Write a for statement to print integer 1 to 20. [example]
int i;
For (i=1; i<=20; i++)
System.out.Println(i);
I. Write a for statement to print integer 1 to 10. [3 marks]
II. Write a while statement to print integer 1 to 10. [3 marks]
8. Write a an algorithm and a java program that displays the following table:-
(note that 1 kilogram is 2.2 pounds):
[10 marks]
Kilograms Pounds
1 2.2
3 6.6
...
100 220
8/19/2015
DCT1083 OOP: Assignment 2
A. You are required to provide:-
(i)
Algorithm (Flowchart or Pseudocode) and
(ii)
Java program for each of the following problems.
1.
Read 10 integers and find the total of positive number and
negative number.
2.
Write
a program that prompts the user to enter the number of students and each
student's name and score, and finally displays the student with the highest
score.
|
B. Write a method that computes the commission, using the
following rate table . The header of the method is:
|
public
static double computeCommission(double salesAmount)
Sales Amount Commission Rate
$0.01–$5,000
8 percent
$5,000.01–$10,000
10 percent
$10,000.01
and above 12 percent
7/14/2015
DCT1093 OOP. Selamat Hari Raya. Maaf Zahir & Batin
/**
* @(#)MaafRaya0_0.java
*/
import java.util.Scanner;
public class MaafRaya0_0 {
public static void main(String[] args) {
String answer;
boolean maaf=false;
Scanner input = new Scanner(System.in);
System.out.println("Selamat Menyambut Hari Raya");
do {
System.out.println("Mohon Maaf Zahir & batin : ya / tidak");
answer = input.next();
if (answer.equals("ya")){
maaf=true; }
}while(maaf!=true);
System.out.println("Terima Kasih kerana sudi maafkan kami, 0-0 ya. ");
}
}
* @(#)MaafRaya0_0.java
*/
import java.util.Scanner;
public class MaafRaya0_0 {
public static void main(String[] args) {
String answer;
boolean maaf=false;
Scanner input = new Scanner(System.in);
System.out.println("Selamat Menyambut Hari Raya");
do {
System.out.println("Mohon Maaf Zahir & batin : ya / tidak");
answer = input.next();
if (answer.equals("ya")){
maaf=true; }
}while(maaf!=true);
System.out.println("Terima Kasih kerana sudi maafkan kami, 0-0 ya. ");
}
}
Subscribe to:
Posts (Atom)
Cara download Installer windows 10 dalam format ISO
1. Jika anda bercadang untuk download windows 10 melalui website rasmi windows - pilihan untuk download dalam format ISO tidak di berikan. ...
-
1.TOPUP Cepat Susut Jika anda merasa topup prepaid anda cepat susut walaupun tak banyak call- ada baiknya anda semak log call/sms/content ...
-
Section 8 The String Class 8.1 Suppose that s1 , s2 , s3 , and s4 are four strings, given as follows: String s1 = ...
-
1. Jika anda bercadang untuk download windows 10 melalui website rasmi windows - pilihan untuk download dalam format ISO tidak di berikan. ...

