Chapter 6 Method (Buku Liang)
Write method headers for the following methods:
• Computing average, given 2 integers.
CONTOH JAWAPAN : public static double avg(int N1, int N2)
• Find maximum, given 3 integers.
• Computing a sales commission, given the sales amount and the commission rate.
• Printing the calendar for a month, given the month and year.
• Computing a square root.
• Testing whether a number is even, and returning true if it is.
• Printing a message a specified number of times.
• Computing the monthly payment, given the loan amount, number of years, and annual interest rate.
• Finding the corresponding uppercase letter, given a lowercase letter.
3/30/2016
3/26/2016
BCS2233 OOP . Assignment 2
You are required to provide:-
(i) Algorithm (Flowchart or Pseudocode) and
(ii) Java program
for the following problem.
Write a program that reads positive integers, finds the smallest of them. Assume that the input ends with number -1. Suppose that you entered 3 5 2 5 5 5 -1; the program finds that the smallest is 2.
Here are sample runs of the program:
Sample 1: Enter numbers:
3
5
2
5
5
5
-1
The smallest number is 2.
Due Date : 10/4/2016
(i) Algorithm (Flowchart or Pseudocode) and
(ii) Java program
for the following problem.
Write a program that reads positive integers, finds the smallest of them. Assume that the input ends with number -1. Suppose that you entered 3 5 2 5 5 5 -1; the program finds that the smallest is 2.
Here are sample runs of the program:
Sample 1: Enter numbers:
3
5
2
5
5
5
-1
The smallest number is 2.
Due Date : 10/4/2016
3/07/2016
BCS2233 OOP: Markah Quiz 1
Markah quiz 1 adalah seperti berikut:-
| No. | Matric No. | Course | Quiz 1 (10) |
| 1 | 14B07001 | BCNS | 10 |
| 2 | 14B07002 | BCNS | 10 |
| 3 | 14B07013 | BCNS | 10 |
| 4 | 14B07015 | BCNS | 10 |
| 5 | 14B07018 | BCNS | |
| 6 | 14B07022 | BCNS | |
| 7 | 14B07026 | BCNS | 10 |
| 8 | 14B07029 | BCNS | 10 |
| 9 | 14B07035 | BCNS | 10 |
| 10 | 14B08001 | BCNS | 10 |
3/06/2016
BCS2233 OOP . Exercise / LAB
Kelaskan Jenis Masalah di bawah berdasarkan kotegori berikut:-
(A=sequence
Only, B=Selective,C=Iteration)
2/29/2016
BCS2233 OOP . Assignment 1
Soalan Tugasan 1 (Assignment 1) boleh di dapati dari link berikut:-
Assignment 1
Tarikh hantar ialah :- 10/3/2016
Assignment 1
Tarikh hantar ialah :- 10/3/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
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. ...
