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);
}
}
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. ...
-
ANSWERS TO CHAPTER EXERCISES (CHAPTER 8) Review Questions 1. List and describe various types of output, including technolog...
-
Based on real life scenario on any local company/ organization which you are very familiar, define the problem that could be addressed thr...
-
A. Response to the following statements by circling either T (TRUE) or F (FALSE). [10M] I. 1. Java enables users...