Sunday, February 27, 2011

Exercise Answer

Exercise 1

a) const double Pi=3.14;


b) double Parameter;


c)cout<<"input data";
cin>>data;


d) int num_compt;
cout<<"input number of computer";
cin>>num_compt;




Exercise 2

a) 5 * 2 % 3 + 25 / 5
=10%3+25/5
= 1+5
= 6


b) a = 5, b = 6 !((a < a ="="> 9))
!((5 < 5 ="="> 9))
!(1 && 0 0 )
!(00)
!(0)
1




Exercise 3

main()
{
float allowance=300.00;
float salary;
cout<<"Input Salary=";
cin>>salary;
Tsalary=salary+ Allowance;
cout>>"Salary is=" , salary;
}




Exercise 4

#include
main()
{
double day_salary;
int days=20;
double monthly_salary;


cout<<"enter day salary";
cin>>day_salary;
cout<<"enter days working";
cin>>days;

monthly_salary=Day_salary*days;
cout<<"Your monthly salary =", monthly_salary;
}




Exercise 5

Program that calculates the average of 5 numbers that can be input by user.

#include iostream.h
main()
{
int num1, num2, num3, num4, num5, average;
cout<<"enter number 1";
cin>>num1;
cout<<"enter number 2";
cin>>num2;
cout<<"enter number 3";
cin>>num3;
cout<<"enter number 4";
cin>>num4;
cout<<"enter number 5";
cin>>num5;

average=(num1+num2+num3+num4+num5)/5;
cout<<"average for five number is=" , average;


}






Exercise 6

Program that will calculate the area of rectangular, triangle and circle.

#include iostream.h
main()
{
double area_rect , area_triangle, area_circle, base , height, width, radius;
const double =3.14;
cout<<"Calculate area of rectangular.";
cout<<"Enter height=";
cin>>height;
cout<<"Enter width";
cin>>width;
area_rect=height * width;
cout<<"area of rectangular=", area_rect;


cout<<"Calculate area of triangle.";
cout<<"Enter base=";
cin>>base;
cout<<"Enter height";
cin>>height;
area_triangle= 1/2 * base * height ;
cout<<"area of triangle=", area_triangle;


cout<<"Calculate area of circle.";
cout<<"Enter radius=";
cin>>radius;
area_circle= 3.14;
cout<<"area of circle=", area_circle;


}

(Weekly Reflection 2)

*Msuk kls mcm biase dan sign attendance.
*Miss bg rehat stngh jam dan msuk smula kls pd pkul 10.
*Bljr chapter 2.
*Miss bg exercise 2 tntg coding (buat dlm kmpuln).
*Buat weely reflection by group.
*Balik.

Sunday, February 6, 2011

Example of Algorithm,Pseudocode, and Flowchart

Find the perimeter of a rectangle.The perimeter of the rectangle are given by the following formulas:



Perimeter=2*(length+width)



Algorithm:



1. Get the input variable length and width.

2. Calculate the perimeter by using the formula

perimeter=2*(length+width)

3. Display the perimeter.



Pseudocode:



START

Input length,width

Set the variable perimeter

perimeter=2*(length+width)

Print the perimeter

END





Flowchart:

FUNDAMENTAL OF PROGRAMMING (FOP)

Pd aq,sbjk FOP ssh & aq agk trkjt bile aq kne amek sbjek niwh.Tp dgn hti x rela,pkirn yg rnsing,jiwe yg kcau trpkse jgk r aq rgister sbjek FOP..huh!!! redha jelh aq...kah3..Tp aq akn bljr btol2 & aq akn fhmkn smua chpter yg ad dlm sbjek FOP niwh.Aq hrp,,Pn.Ayuni brsbr dlm mngajr aq..cz aq mmg ssh nk fhm bab2 programming & coding.Oklh,,Dlm sbjk FOP first2 skali,,aq bljr ape itu Algorithm,Pseudocode, & Flowchart.So,,ini yg dpt aq rungkaikn...

Algorithm:
Satu siri arahan yang ditulis menggunakan bahasa yang ditulis menggunakan bahasa yang boleh difahami untuk menyelesaikan masalah.

Pseudocode:
Langkah-langkah menyelesaian masalah yang ditulis menggunakan sebahagiannya bahasa pengaturcaraan tertentu dan sebahagiannya pula bahasa pertuturan biasa.

Flowchart:
Rajah-rajah yang menggunakan simbol-simbol grafik untuk menunjukkan proses atau langkah-langkah dalam penyelesaian masalah.


(Weekly Reflection 1)

*Kami dibahagikn kpd bbrpa kmpuln.

*Forum-Bincang pndpt masing2 tntg FOP.

*Weekly Reflection-Mnergkn ape yg aq bljr tntg FOP dlm masa 4 jam kls.

*Zip File diberi 5 mark (4 Assignment) dh x gne paper.

*Buat Blog (blogspot.com/wordpress.com)-10mark.

*Midterm-10 mark.

*Final-40 mark (15 mark br lulus).

*URL.

*Sesi perknln.

*Bljr Chpter 1:

-Algorithm

-Psedocode

-Flowchart

*Activity-Stiap kmpuln msti selesaikn krje yg miss bg & tulis jwpn di whiteboard.

INTRODUCTION OF FOP

Pd mulenya FOP just utk bdk course IT,tp thn niwh bdk E-BUSINESS kne amek plk sbjk niwh...em,,pning aq.X ke plik tetibe je bdk E-BUSINESS kne amek sbjk IT,,pork prnde jdnye... Tp ape bleh wt,,dh lcture ckp bdk E-BUSINESS wajib amek sbjk FOP niwh cz pnting bg bdk course E-BUSINESS sprti aq amek FOP ats sbb2 trtntu.Aq pown x twu ape sbb2 dye..haha~