1. Write a java program for the following problems:-
i) Print 1,2,3..20 using while loop
ii) Print 1,2,3..20 using do..while loop
iii) Print 1,2,3..20 using for loop
2. (Conversion from kilograms to pounds) Write a program that displays the following table (note that 1 kilogram is 2.2 pounds). The flowchart has been prepared for you.
Kilograms Pounds
1 2.2
3 6.6
...
197 433.4
199 437.8
3. (Conversion from miles to kilometers) Write a program that displays the following table (note that 1 mile is 1.609 kilometers): Prepare the flowchart first prior to java program.
Miles Kilometers
1 1.609
2 3.218
...
9 14.481
10 16.090
5/17/2017
5/10/2017
BCS2233 OOP : Lab 11 Mei 2017
1 Berikut adalah flowchart dan program java untuk permainan meneka nombor (di ambil dari 05slide.ppt, slaid nombor 17) .
2. (Count positive and negative numbers and compute the average of numbers) Write
a program that reads an unspecified number of integers, determines how many
positive and negative values have been read, and computes the total and average of
the input values (not counting zeros). Your program ends with the input 0. Display
the average as a floating-point number. Here is a sample run:
Sedikit perubahan (teks biru) telah di buat terhadap terhadap perjalanan permainan ini sebagai mana yang di tunjukkan pada flowchart di bawah. Ubah suai program java di atas.
2. (Count positive and negative numbers and compute the average of numbers) Write
a program that reads an unspecified number of integers, determines how many
positive and negative values have been read, and computes the total and average of
the input values (not counting zeros). Your program ends with the input 0. Display
the average as a floating-point number. Here is a sample run:
5/02/2017
4/26/2017
BCS2233 OOP : Sample for Quiz 1
Write an algorithm (flowchart) for a java program
that input height and weight, calculate the BMI and output the Healthy Status.
For example, if a person is 60 KG and 1.69 Meters, Here is a sample run:
Enter weight in KG: 




60
Enter height in Meter: 





1.69
BMI is 21
Normal Weight
BMi
Formula and Health Status are given below:
BCS2233 OOP : Lab 27 April 2017
1.Fahamkan struktur program Java di bawah.
2. Lukis flowchart yang setara dengan logik program Java berkenaan.
3. Hanya guna tulisan tangan untuk melukis dan menulis.
4. Emailkan hasil kerja ("scan atau snap gambar") kepada nazri.ibrahim@gmail.com
5. Email perlu sampai selewat-lewatnya jam 6.00pm pada 27/4/2017.
6. Terima Kasih.
import java.util.Scanner;
public class lab27April {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.println("Sila Masukkan empat nombor ");
int n1 = input.nextInt();
int n2 = input.nextInt();
int n3 = input.nextInt();
int n4 = input.nextInt();
System.out.println("Rojak");
if(n1>n2)
{
System.out.println("Cincau");
if(n3>n4)
{
System.out.println("Nasi Ayam");
}
}
else
{
System.out.println("Nasi Tomato");
}
System.out.println("Pasembor");
}
}
2. Lukis flowchart yang setara dengan logik program Java berkenaan.
3. Hanya guna tulisan tangan untuk melukis dan menulis.
4. Emailkan hasil kerja ("scan atau snap gambar") kepada nazri.ibrahim@gmail.com
5. Email perlu sampai selewat-lewatnya jam 6.00pm pada 27/4/2017.
6. Terima Kasih.
import java.util.Scanner;
public class lab27April {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.println("Sila Masukkan empat nombor ");
int n1 = input.nextInt();
int n2 = input.nextInt();
int n3 = input.nextInt();
int n4 = input.nextInt();
System.out.println("Rojak");
if(n1>n2)
{
System.out.println("Cincau");
if(n3>n4)
{
System.out.println("Nasi Ayam");
}
}
else
{
System.out.println("Nasi Tomato");
}
System.out.println("Pasembor");
}
}
4/16/2017
BCS2233 OOP : Assignment 1 (Tugasan 1)
1. Berikut adalah tugasan pertama untuk BCS2233.
2. Pelajar di minta menulis "pseudocode" dan melukis "flowchart" untuk 3 soalan yang di berikan.
3. Semua kerja adalah dalam bentuk tulisan tangan dan di hantar dalam bentuk "hard copy".
4. Tarikh akhir hantar adalah pada 4 Mei 2017.
5. Tugasan adalah Individu.
6. Pelajar akan di "interview" dalam proses saya memberi markah.
Terima Kasih.
2. Pelajar di minta menulis "pseudocode" dan melukis "flowchart" untuk 3 soalan yang di berikan.
3. Semua kerja adalah dalam bentuk tulisan tangan dan di hantar dalam bentuk "hard copy".
4. Tarikh akhir hantar adalah pada 4 Mei 2017.
5. Tugasan adalah Individu.
6. Pelajar akan di "interview" dalam proses saya memberi markah.
Terima Kasih.
4/12/2017
BCS2233 OOP : Programming Exercise1
Programming Exercise 1.
(please provide flowchart and java program for each question. You can create flowchart online at https://www.draw.io/)
1. (Calculate body mass index (BMI) ) Write a program that reads a Weight and Height, then calcculate BMI and displays the result . The formula for the BMI is as follows:
BMI = Weight / (Height x Height);
2. (Converting Fahrenheit to Celsius) Write a program that reads a Fahrenheit degree, then converts it to Celsius and displays the result . The formula for the conversion is as follows:
celsius = (5/9) * (fahrenheit - 32)
Hint
In Java, 5 / 9 is 0, so you need to write 5.0 / 9 in the program to obtain the correct result.
3. (Computing the volume of a cylinder) Write a program that reads in the radius and length of a cylinder and computes its volume using the following formulas:
area = radius * radius * pi
volume = area * length
(pi = 3.14)
Solution
Question 1.
import java.util.Scanner;
public class hello1 {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
// Prompt the user to enter weight in KG
System.out.print("Enter weight in Kilogram: ");
double weight = input.nextDouble();
// Prompt the user to enter height in Meters
System.out.print("Enter height in Meters: ");
double height = input.nextDouble();
// Compute BMI
double bmi = weight / (height * height);
// Display result
System.out.println("Your BMI is " + bmi);
}
}
(please provide flowchart and java program for each question. You can create flowchart online at https://www.draw.io/)
1. (Calculate body mass index (BMI) ) Write a program that reads a Weight and Height, then calcculate BMI and displays the result . The formula for the BMI is as follows:
BMI = Weight / (Height x Height);
2. (Converting Fahrenheit to Celsius) Write a program that reads a Fahrenheit degree, then converts it to Celsius and displays the result . The formula for the conversion is as follows:
celsius = (5/9) * (fahrenheit - 32)
Hint
In Java, 5 / 9 is 0, so you need to write 5.0 / 9 in the program to obtain the correct result.
3. (Computing the volume of a cylinder) Write a program that reads in the radius and length of a cylinder and computes its volume using the following formulas:
area = radius * radius * pi
volume = area * length
(pi = 3.14)
Solution
Question 1.
import java.util.Scanner;
public class hello1 {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
// Prompt the user to enter weight in KG
System.out.print("Enter weight in Kilogram: ");
double weight = input.nextDouble();
// Prompt the user to enter height in Meters
System.out.print("Enter height in Meters: ");
double height = input.nextDouble();
// Compute BMI
double bmi = weight / (height * height);
// Display result
System.out.println("Your BMI is " + bmi);
}
}
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. ...









