9/13/2017
BCS1223 Lab 14 Sept 2017
Review : Objects and Classes
Give both Structured and Object Oriented solution for the following problems.
1. Write a java program that reads the length and height of a rectangle and computes its area and parameter using the following formulas:-
Area = length x height
Perimeter = 2 x (length + height)
2. Write a java program that reads the height of a cube and computes its volume and parameter using the following formulas:-
Volume = height x height x height
Perimeter = 4 x height
3. Write a program that reads in the radius and length of a cylinder and computes its volume using the following formulas:
Area = radius * radius * 3.14
Volume = area * length
9/10/2017
DCT1144 Programming Fundamentals LAB 11 Sept 2017
1. Design an algorithm and write a C++ program 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
Algorithm
1. Get length of the rectangle
2. Get width of the rectangle
3. Find the perimeter using the following equation:
perimeter = 2 * (length + width)
4. Find the area using the following equation:
area = length * width
5. Print perimeter and area
C++ Program
#include
#include
using namespace std;
int main(int argc, char *argv[])
{
int length, width, Perimeter, Area;
cout<<" Please enter length and width of a rectangle \n";
cin>>length;
cin>>width;
Perimeter = 2* (length + width);
Area = length * width;
cout<<"Perimeter of a rectangle = "< cout<<"\n Area of a rectangle = "< system("PAUSE");
return EXIT_SUCCESS;
}
2. Design an algorithm and write a C++ program that reads a Fahrenheit degree in double, then converts it to Celsius and displays the result in a message dialog box. The formula for the conversion is as follows:
celsius = (5/9) * (fahrenheit - 32)
3. Design an algorithm and write a C++ program that calculates the sales tax and the price of an item sold in a particular state State’s portion of the sales tax is 4% City’s portion of the sales tax is 1.5% If the item is a luxury item, then there is a 10% luxury tax.
4. Design an algorithm and write a C++ program that input two integers and find the largest.
perimeter = 2 * (length + width)
area = length * width
Algorithm
1. Get length of the rectangle
2. Get width of the rectangle
3. Find the perimeter using the following equation:
perimeter = 2 * (length + width)
4. Find the area using the following equation:
area = length * width
5. Print perimeter and area
C++ Program
#include
#include
using namespace std;
int main(int argc, char *argv[])
{
int length, width, Perimeter, Area;
cout<<" Please enter length and width of a rectangle \n";
cin>>length;
cin>>width;
Perimeter = 2* (length + width);
Area = length * width;
cout<<"Perimeter of a rectangle = "<
return EXIT_SUCCESS;
}
2. Design an algorithm and write a C++ program that reads a Fahrenheit degree in double, then converts it to Celsius and displays the result in a message dialog box. The formula for the conversion is as follows:
celsius = (5/9) * (fahrenheit - 32)
3. Design an algorithm and write a C++ program that calculates the sales tax and the price of an item sold in a particular state State’s portion of the sales tax is 4% City’s portion of the sales tax is 1.5% If the item is a luxury item, then there is a 10% luxury tax.
4. Design an algorithm and write a C++ program that input two integers and find the largest.
9/04/2017
BCS1013 Problem Solving and Computer Programming 2017 2018 Sem 1
Berikut adalah bahan-bahan yang akan di gunakan untuk BCS1013 Problem Solving and Computer Programming 2017 2018 Sem 1.
1. Course Plan
2.Powerpoint Slides
Introduction to Algorithm (Flowchart and Pseudocode)
3. Lab Sheet
4. Editor untuk menulis program. Perisian Dev-C++
akan di gunakan untuk menulis aturcara. Perisian telah tersedia di
Makmal. Jika pelajar ingin memasang (install) pada komputer sendiri,
sila download dari pautan berikut: http://www.bloodshed.net/dev/index.html. Rujuk cara memasang pada pautan berikut: https://ceng230.ceng.metu.edu.tr/Compilers/dev-cpp.html
9/03/2017
DCT1144 Programming Fundamentals 2017 2018 Sem 2
Saya akan mengendalikan subjek Programming Fundamentals untuk sem 2 2017 2018. Berikut adalah bahan-bahan yang akan di gunakan sepanjang semester berkenaan.
1. Course Plan
2.Powerpoint Slides
Introduction to Algorithm (Flowchart and Pseudocode)
3. Lab Sheet
4. Editor untuk menulis program. Perisian Dev-C++ akan di gunakan untuk menulis aturcara. Perisian telah tersedia di Makmal. Jika pelajar ingin memasang (install) pada komputer sendiri, sila download dari pautan berikut: http://www.bloodshed.net/dev/index.html. Rujuk cara memasang pada pautan berikut: https://ceng230.ceng.metu.edu.tr/Compilers/dev-cpp.html
7/12/2017
BCS2233 OOP. Quiz 4
//Button (also
called Nodes) on Pane (also called Parent)
//Pane on
Scene
//Scene on
Stage
import
javafx.application.Application;
import
javafx.scene.Scene;
import
javafx.scene.control.*;
import
javafx.stage.Stage;
import javafx.scene.layout.StackPane;
public class
myJavaDIY extends Application {
@Override
public void start(Stage myStage){
myStage.setTitle("This is
Stage");
Button btnOK = new Button();
btnOK.setText("OK");
TextField nametxt = new TextField();
StackPane Pane = new
StackPane();
Pane.getChildren().add(btnOK);
Scene myScene = new Scene(Pane);
myStage.setScene(myScene);
myStage.show();
}
public static void main(String[] args) {
System.out.println("Hello
World!");
launch();
}
}
BCS2233 OOP : List if Group. Assignment 3
| Nuraina Yasmin Binti Roslizi | A |
| Munirah Binti Abdul Rahim | A |
| Nur Afiffah Binti Fauzan | B |
| Syaza Athirah Bin Mohd Shah Budin | B |
| Nur Hafizah Binti Mustafa | C |
| Luqman Hakim Bin Mahmod | D |
| Mohd Harith Aslam Bin Noor Azman | D |
| Mohammad Faisal Bin Othman | E |
| Amal Ifwat B Ibrahim | E |
| Ahmad Khairi Fathi Bin Che Ghani | F |
| Syed Muhamad Arif Bin Syed Masahor | F |
| Mohamad Redzuan Bin Ramly | G |
| Shahrul Naim Bin Shahrudin | G |
| Farah Naquila Binti Mohamad | H |
| Umairazatul Husna Bt Shamsol Kamal | H |
| Adibah Binti Mat Supian | I |
| Izzat Widdad Binti Mohd Azhar | J |
| Hasfalizieyana Binti Hashim | J |
| Wan Nur Syafiqa Binti Wah Hussin | K |
| Mohammad Tajauddin Bin Rahim | K |
| Nur Sadrina Aniya Ahmad | L |
| Che Mohamad Mifzal Bin Che Osman | M |
| Muhammad Khairul Naim Bin Nor Ashari | M |
| Mohd Thanauddin Bin Othman | |
| Uzair Bin Zamri | |
| Ahmad Sakhwai Bin Ahmad Sanusi |
7/05/2017
BCS2233 OOP. LAB Array and GUI
1. Read ten numbers, compute their average, and find out how many numbers are above the average.
Answers
import java.util.Scanner;
public class demoArray1 {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
double[] arrayNum = new double[10];
int i,moreThanAvg;
double num,sum,avg;
sum=0;
moreThanAvg=0;
System.out.println("Input 10 Numbers ");
for(i=0;i<=9;i++){
num= input.nextDouble();
arrayNum[i]=num;
sum = sum +num;
}
avg=sum/10;
System.out.println("Sum of 10 numbers ="+sum);
System.out.println("Average of 10 numbers="+avg);
for(i=0;i<=9;i++){
if (arrayNum[i]>avg)
moreThanAvg++;
}
System.out.println("Total of number above average ="+moreThanAvg);
}
}
2. Write a program statement that will do the following of array N as shown below:-
int[] arrayN = new int[10];
for(i=0;i<=9;i++){
arrayN[i]=i+1;
}
i) Print first element.
ii) Print last element.
iii) Print all elements (use loop).
iv) Replace third element with 5.
v) Replace last element with 100;
vi) Copy the elements in the fifth location into the first one.
vii) Increase the sixth element by 10.
viii) Decrease the second element by 1;
ix) Sum and print all elements.
x) Print only odd element(s).
3. Show output of the following java program.
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.stage.Stage;
public class MyJavaFX extends Application {
@Override // Override the start method in the Application class
public void start(Stage primaryStage) {
// Create a button and place it in the scene
Button btOK = new Button("OK");
Scene scene = new Scene(btOK, 200, 300);
primaryStage.setTitle("My First GUI"); // Set the stage title
primaryStage.setScene(scene); // Place the scene in the stage
primaryStage.show(); // Display the stage
}
public static void main(String[] args) {
launch();
}
}
4. Write a java program to print the following output:
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. ...
