Monday, March 28, 2011

Weekly Reflection 6

Selama 4 jam berada di kelas FOP (^_^)

Seperti biasa kami diberi masa rehat dari jam 9am - 10am. Miss bagi kami latihan yg Exercise Question Past Years, kemudian Miss memberi tempoh siapkan tugasan dari jam 10am - 12pm. Setelah itu, kami kene bagi jawapan kat papan putih. Miss nak semak jawapan yang kami buat kat depan. Setelah siap semua, Miss bagi lagi kami tugasan assignment yang kedua iaitu buat Sifir menggunakan coding looping.

~ Kelas Tamat ~

Exercise 2



#include < iostream.h >
main()
{

//declaire variable
float cgpa, total, total2;

cout<<"Muhammad FIrdaus Bin Hasmi"< cout<<"05-201006-00003"<
//input
cout<<"\nPlease enter your CGPA = ";
cin>>cgpa;

if (cgpa == 4.00)
{total = (100/100)*16000;
total2 = 16000 - total;}

else if (3.00<=cgpa<=3.99)
{total = (80/100)*16000;
total2 = 16000 - total;}

else if (2.00<=cgpa<=2.99)
{total = (40/100)*16000;
total2 = 16000 - total;}

else if (0<=cgpa<=1.99)
{total = (100/100)*16000;
total2 = 16000 - total;}

else {cout << "Invalid CGPA";}

//output
cout<<"Your CGPA is " << cgpa< cout<<"Your Discount " << total< cout<<"You have to pay " << total2 <
return 0;
}

Exercise 1


#include < iostream.h >
main()
{

//declaire variable
float cgpa, total, total2;

cout<<"Muhammad FIrdaus Bin Hasmi" << endl;
cout<<"05-201006-00003" << endl;

//input
cout<<"\nPlease enter your CGPA = ";
cin>>cgpa;

if (cgpa == 4.00)
{total = (100/100)*16000;
total2 = 16000 - total;}

else if (3.00<=cgpa<=3.99)
{total = (80/100)*16000;
total2 = 16000 - total;}

else if (2.00<=cgpa<=2.99)
{total = (40/100)*16000;
total2 = 16000 - total;}

else if (0<=cgpa<=1.99)
{total = (100/100)*16000;
total2 = 16000 - total;}

else {cout << "Invalid CGPA";}

//output
cout<<"Your CGPA is " << cgpa << endl;
cout<<"Your Discount " << total << endl;
cout<<"You have to pay " << total2 << endl;

return 0;
}

Integer




#include < iostream.h >
main()
{

//declaire variable
int multiply, num1, num2;

cout<<"Muhammad FIrdaus Bin Hasmi" << endl;
cout<<"05-201006-00003" << endl;

//input1
cout<<"\nPlease insert number 1 = ";
cin>>num1;

//input2
cout<<"Please insert number 2 = ";
cin>>num2;

//formula
multiply = num1 * num2;

//output
cout<<"\nThe answer is = " << multiply << endl << endl;

return 0;
}

Programming Exercise Switch...Case...


#include < iostream.h >
main()
{

//declair variable
int selection, quantity;
double price;

cout<<"Muhammad FIrdaus Bin Hasmi" << endl;
cout<<"05-201006-00003" << endl;

cout<<"\n1.Pen = RM 0.50";
cout<<"\n2.Pensil = RM 0.30";
cout<<"\n3.Ruler = RM 0.20";
cout<<"\n4.Erser = RM 0.10";

cout<<"\n\nEnter your selection = ";
cin>>selection;
cout<<"\nEnter your quantity = ";
cin>>quantity;

switch (selection)
{
case 1 : price = quantity * 0.50;
cout<<"\nPrice = RM " << price;
cout<<"\n\nYour selection is Pen with" << quantity;
cout<<"As your quantity(s)" << endl;
break;

case 2 : price = quantity * 0.30;
cout<<"\nPrice = RM " << price \n;
cout<<"\nYour selection is Pensil with" << quantity;
cout<<"As your quantity(s)" << endl;
break;

case 3 : price = quantity * 0.20;
cout<<"\nPrice = RM " << price << endl;
cout<<"\nYour selection is Ruler with " << quantity;
cout<<"As your quantity(s)" << endl;
break;

case 4 : price = quantity * 0.10;
cout<<"\nPrice = RM " << price << endl;
cout<<"\nYour selection is Erser with " << quantity;
cout<<"As your quantity(s)" << endl;
break;

default : cout<<"\nInvalid selection" << endl;
}

return 0;
}

Questions


Question 1
1.Fill in the blanks with the appropriate data types for the following variables declaration syntax;
a)________Number 1= 1
b)________Number 3=3.0
c)________Text 1=''I have a car ''
d)________Huruf=''B''
e)________Account No=''66666664443''


Question 2
You are given PTPTN loan with the amount of RM16000.Calculate the amount that you should pay after PTPTN discount based on the CGPA.You must use if...else statement.

CGPA Diskaun
4.00 100%
3.99-3.00 80%
2.99-2.00 40%
0-1.99 0%

output:

Jumlah pinjaman = RM16000.00
CGPA yang diperoleh=3.00
Diskaun=RM12800

Jumlah pinjaman yang perlu dibayar selepas diskaun =RM 3200


Question 3
You are required to do a program that will execute the multipy or divide operation.The operation is based on the user's choice.You must use switch...case statement.

Output:

MENU PILIHAN
1.Pendaraban
2.Pembahagian
Masukkan nombor pertama=4
Masukkan nombor kedua=8
Masukkan pilihan anda=1
Hasil darab 4 dan 8 ialah 32


Question 4
Change the algebra expression to arithmetic expression


Question 5
5.Solve the statement below to find all value.Show the working;
a)m=5
m*=(3+4)*2

b)m=2
m*=((3+4)/2)-9


Question 6
6.Find the output for the folowing segment.
a)float var 1= 25.12 var 2= 15.0;

if
cout<<'' var 1 less or same as var 2'';
else
cout<<''var 1 bigger than var 2'';

b)int n= 20;
n/=5'


Question 7
7.Convert the while statement below to for statement.
int j=10;
while(j>0)
{
cout<<'' '' }


Question 8
8.Write a program that reads 4 prices using while loop and calculates the sum of the things 4 program must use function while for calculate the average of the prices.


Answer :


Question 1
1.a) integer
b) float
c) string
d) string
e) string


Question 2


2.#include < iostream.h >
main()
{

//declair variable
float cgpa, diskaun, jumlah_pinjaman, bayaran_pinjaman;

cout<<" Jumlah Pinjaman : ";
cin>>jumlah_pinjaman;
cout<<" CGPA yang diperoleh: ";
cin>>cgpa;

if ((cgpa>=3.99) && (cgpa<=3.00));
diskaun = jumlah_pinjaman * 80/100;
bayaran_pinjaman = jumlah_pinjaman - diskaun;
cout<<"\n Diskaun = " << diskaun;
cout<<" Jumlah pinjaman yang perlu dibayar selepas diskaun = " << jumlah_pinjaman ;

if ((cgpa>=0) && (cgpa<=1.99));
diskaun = jumlah_pinjaman * 0/100;
bayaran_pinjaman = jumlah_pinjaman - diskaun;
cout<<"\n Diskaun = " << diskaun ;
cout<<" Jumlah pinjaman yang perlu dibayar selepas diskaun = "<< jumlah_pinjaman ;

if ((cgpa>=2.99) && (cgpa<=2.00));
diskaun = jumlah_pinjaman * 40/100;
bayaran_pinjaman = jumlah_pinjaman - diskaun;
cout<<"\n Diskaun = " << diskaun ;
cout<<" Jumlah pinjaman yang perlu dibayar selepas diskaun = " << jumlah_pinjaman ;
if (cgpa=4.00);
diskaun = jumlah_pinjaman * 100/100;
bayaran_pinjaman = jumlah_pinjaman - diskaun;
cout<<"\n Diskaun = "<< diskaun ;
cout<<" Jumlah pinjaman yang perlu dibayar selepas diskaun = " << jumlah_pinjaman ;
}

return 0;
}


Question 3


Questions :
3.#include < iostream.h>
main ()
{

//declair variable
int num1,num2,selection,tm,td;

cout<<"Insert Number 1=";
cin>>num1;

cout<<"Insert Number 2=";
cin>>num2;

cout<<"Insert Number Selection=";
cin>>selection;

switch(selection)
{
case 1 : (selection=1)
total_multiply =num1*num2;
cout<<"total_multiply" << tm;

case 2 =(selection=2)
total_divide=num1/num2 ;
cout<<"total divide=" << td;
}

return 0;
}


Question 4
4.a)Y = (m - 4 ax) / 7a
b)Y = 6 bc / (4 sd – 2xy)
c)Y = (( 2 + AB + c ) / 3d ) + 5 xyz
d)Y = (2kb / 2 ki ) – 3 jb
e)Y= xy + x * x – 2 ab


Question 5
5.a) M = 5 * ( 3 + 4 ) * 2
M = (5 * 7 )* 2
M = 35 * 2
M = 70


Question 6
6.a) Float Var 1 = 25.12 , Var 2 = 15.0 ;
If (var 1 <= Var 2 )
Cout << “ Var 1 less or same as Var 2 “ ;
Else
Cout << “ Var 1 bigger than Var 2 “ ;


Question 7


7.#include < iostream.h >
Main()
{

//declaire variable
Int x ;
X = 1 ;
While (x < = 10 )

{
Cout<<”number “<
X++ ;
}
return 0;
}

Output :
Number 1 --------- 1
2 --------- 2
3 --------- 3
4 --------- 4
5 --------- 5
6 --------- 6
7 --------- 7
8 --------- 8
9 --------- 9
10 --------- 10


Question 8


8.#include < iostream.h >
main()
{

//declair variable
int k;
float p,total,averge;

k=1;
while (k<=4)
{
cout<<"Enter price=" << price;
cin>>p;
k++;
total=total+p;
}

Average=total/4;
cout<<"Your total is=" << total;

return 0;
}

Weekly Reflection 5

Selama 4 jam berada di kelas FOP (^_^)

Belajar c++ seperti biasa dan kami diberi tugas untuk menyelesaikan latihan berikut dalam Forum.

Jawapan akan dihantar dan lampirkan dalam Forum. Setiap kumpulan perlu membuat perbincangan kerja sama untuk menyelesaikan tugas mereka sebelum akhir kelas.

Akhirnya, seperti biasa untuk [/ list] Mingguan Refleksi untuk seminggu.

~ Kelas Tamat ~

Homework 2

Subject 1 (0.00) :
Subject 2 (0.00) :
Subject 3 (0.00) :
Subject 4 (0.00) :
Subject 5 (0.00) :

CPA:

FORMULA:
CPA = ((Subject1*3) + (Subject2*3) + (Subject3*2) + (Subject4*2) + (Subject5*4)) / 5



Answer :


#include < iostream.h >
main()
{

//declair variable
float s1, s2, s3, s4, s5, cpa;

cout<<"Muhammad FIrdaus Bin Hasmi" << endl;
cout<<"05-201006-00003" << endl;

//input1
cout<<"\nSubject 1 = ";
cin>>s1;

//input2
cout<<"Subject 2 = ";
cin>>s2;

//input3
cout<<"Subject 3 = ";
cin>>s3;

//input4
cout<<"Subject 4 = ";
cin>>s4;

//input5
cout<<"Subject 5 = ";
cin>>s5;

//process
cpa=(((s1*3)+(s2*3)+(s3*2)+(s4*2)+(s5*4))/5);

//output
cout<<"\nSubject 1 : " << s1;
cout<<"\nSubject 2 : " << s2;
cout<<"\nSubject 3 : " << s3;
cout<<"\nSubject 4 : " << s4;
cout<<"\nSubject 5 : " << s5 << endl;
cout<<"\nCPA is : " << cpa << endl << endl;

return 0;
}


Questions :

Homework 1

Questions :

Assignment 1 (10%):
Assignment 2 (10%):
Assignment 3 (10%):
Assignment 4 (10%):
Assignment 5 (10%):
MidTerm (10%):
Final (40%):

TOTAL (100%):

FORMULA:
TOTAL = Assignment1+Assignment2+Assignment3+Assignment4+Assignment5+MidTerm+Final



Answer :



#include < iostream.h >
main()
{

//declair variable
float ass1, ass2, ass3, ass4, ass5, mid, final, total;

cout<<"Muhammad FIrdaus Bin Hasmi" << endl;
cout<<"05-201006-00003" << endl;

//input1
cout<<"\nassignment 1 = ";
cin>>ass1;

//input2
cout<<"assignment 2 = ";
cin>>ass2;

//input3
cout<<"assignment 3 = ";
cin>>ass3;

//input4
cout<<"assignment 4 = ";
cin>>ass4;

//input5
cout<<"assignment 5 = ";
cin>>ass5;

//input6
cout<<"midterm = ";
cin>>mid;

//input7
cout<<"final = ";
cin>>final;

//formula
total=ass1+ass2+ass3+ass4+ass5+mid+final;

//output
cout<<"\nOutput :- " << endl;
cout<<"assignment 1 = " << ass1 << endl;
cout<<"assignment 2 = " << ass2 << endl;
cout<<"assignment 3 = " << ass3 << endl;
cout<<"assignment 4 = " << ass4 << endl;
cout<<"assignment 5 = " << ass5 << endl;
cout<<"midterm = " << mid << endl;
cout<<"final = " << final << endl;
cout<<"\ntotal = " << total << endl << endl;

return 0;
}

Sunday, March 27, 2011

Buat Sifir



#include < iostream.h >
main()
{

//declair variable
int i, j;
char exit;

cout<<"Muhammad FIrdaus Bin Hasmi" << endl;
cout<<"05-201006-00003" << endl;

cout<<"\n*****";
cout<<"\nSIFIR";
cout<<"\n*****" << endl;

i=1;
while (i<=12)
{
cout<<"\n";
for (j=1; j<=12; j++)
{
cout<<" "<< i*j;
}
i++;
}
cout<<"\n\nType EXIT to close=";
cin>>exit;

return 0;
}

Mesin Minuman Tin (SWITCH...CASE)



*****************
MESIN TIN MINUMAN
-----------------
1- PEPSI
2- COCA COLA
3- F&N MIRINDA
4- F&N ORANGE
5- 100 PLUS
*****************

Enter your drink:
Enter your money (RM):

Your drink is __________ and your balance are __________

*If the customer does not enter enough money, asked the customer to insert the money. (if...else)



Answer :

#include < iostream.h >
#include < string.h >
#include < conio.h >
#include < stdio.h >

int main()
{

//declare variable
int selection;
float price, money;
char drink[50];

cout<<"\n**********";
cout<<"\nMESIN TIN MINUMAN";
cout<<"\n__________";
cout<<"\n1.PEPSI";
cout<<"\n2.COCA COLA";
cout<<"\n3.F&N MIRINDA";
cout<<"\n4.F&N ORANGE";
cout<<"\n5.100 PLUS";
cout<<"\n**********\n";

cout<<"Enter your drink=";
cin>>selection;
cout<<"Enter you money=";
cin>>money;

//switch...case
switch (selection)
{

case 1: strcpy(drink,"PEPSI");
price=1.70;
break;

case 2: strcpy(drink,"COCA COLA");
price=1.80;
break;

case 3: //drink[50]="F&N MIRINDA";
price=1.50;
break;

case 4: //drink="F&N ORANGE";
price=1.30;
break;

case 5: //drink="100 PLUS";
price=1.60;
break;

default: cout<<"invalid selection";

}

if(money>price)
{
float balance=money-price;
cout<<"your drink is " << drink;
cout<<" and your balance are" << balance;


}
else
{


/*add=price-money;
please add (RM << add << )=
cin>>add_money;
balance=money+add_money;
cout<<"your drink is" << drink << and your balance
are << balance;
*/
}


getch();

return 0;
}



Questions :

Monday, February 28, 2011

Exercises (23/02/2011)

1. Write correct C++ syntax & for each statement below:
a) Initializing variable Pi with the value 3.14 (constant)
b) Declare a variable named Parameter with double data type (declare variable)
c) Give instruction that allowed user to input data (input)
d) Input number of computer using variable (input assign to variable value)

2. Solve the question below. Show the working.
a) 5 * 2 % 3 + 25 / 5
b) a = 5, b = 6
!((a < 3) && (a == 3) || (b > 9))

3. Identify syntax errors in the following program.

include < iostream.h >
main()
{
float allowance = 300.00, salary;

cout<<"Input Salary = ";
cin>>salary;

TSalary = salary + Allowance;

cout<<"Salary is= "<< salary;
}

4. Write a program that will calculate the monthly salary for an employee that where Saturday and Sunday considered as non-working days.

5. Write a program that calculates the average of 5 numbers that can be input by user.

6. Write a program that will calculate the area of rectangular, triangle and circle.


Answer :

1. Write correct C++ syntax & for each statement below :

a) const pi = 3.14

b) double parameter;

c) cout>>"Enter your data: ";
cin<< data;

d) int num;
num = 3;
cout>>"Number= "<< num;


2. Solve the question below. Show the working.

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

b) a=5 , b=6
!((a<3) && (a==3) || (b>a))
!((5<3) && (5==3) || (6>5))
!((0) && (0) || (0))
!(0) || (0)
!(0)
= 1 or T (True)


3. Identify syntax errors in the following program.

i) #include < iostream.h >

ii) float TSalary;

iii) cout<<"input_salary=";

iv) return 0;

v) }


4.Write a program that will calculate the monthly salary for an employee that where Saturday and Sunday considered as non-working days


#include < iostream.h >
main()
{

//declare
float allowance=500.00, salary=40, tsalary, day;

cout<<"Muhammad FIrdaus Bin Hasmi" << endl;
cout<<"05-201006-00003" << endl;

//input
cout<<"\nease input total days work = ";
cin>>day;

//process
tsalary = (salary*day)+allowance;

//output
cout<<"The total salary for this month is = RM " << tsalary << endl << endl;

return 0;
}





5. Write a program that calculates the average of 5 numbers that can be input by user.


#include < iostream.h >
main()
{

//declaire variable
float num1, num2, num3, num4, num5, average;

cout<<"Muhammad Firdaus Bin Hasmi";
cout<<"05-201006-00003";

//input 1
cout<<"Enter Number 1 = ";
cin>>num1;

//input 2
cout<<"Enter Number 2 = ";
cin>>num2;

//input 3
cout<<"Enter number 3 = ";
cin>>num3;

//input 4
cout<<"Enter Number 4 = ";
cin>>num4;

//input 5
cout<<"Enter number 5 = ";
cin>>num5;

//formula
average=(num1+num2+num3+num4+num5);

//output
cout<<"The answer is = " << average <
return 0;
}




6. Write a program that will calculate the area of rectangular, triangle and circle.


#include < iostream.h >
main()
{
//declaire
float b, h, r, w, area;
float pi=3.14;
int selection;

//out
cout<<"Muhammad FIrdaus Bin Hasmi" << endl;
cout<<"05-201006-00003" << endl;

cout<<"\nPlease choose you choice" << endl;
cout<<"1.Rectangular";
cout<<"\n2.Triangle";
cout<<"\n3.Circle" << endl;
cin>>selection;
switch (selection)
{
case 1: cout<<"Please input the height = ";
cin>>h;
cout<<"Please input the width = ";
cin>>w;
//process
area = w*h;
cout<<"The area is = " << area << endl < break;

case 2: cout<<"Please input the height = ";
cin>>h;
cout<<"Please input the base = ";
cin>>b;
//process
area = 0.5*b*h;
cout<<"The area is:" << area << endl << endl;
break;

case 3: cout<<"Please input the radius = " << endl;
cin>>r;
//process
area = pi*r*r;
cout<<"The area is:" << area << endl << endl;
break;

default :cout<<"Invalid Selection";
}


return 0;
}

Weekly Reflection 4

Selama 4 jam berada di kelas FOP (^_^)

Chapter 4 :

- Buat arithematic operators.
- Relational operators.
- Logical operators.
- Increment & decrement.
- Try doing the maths.
- Kami belajar bagaimana na guna if...else & switch...case statement...
- Miss bagi kitorang exercise 2 buat dlm kelas & homework exercises...upload kat blog (individual).

Time ni aku x hadir sbb bgn lewat.. Maaf ye miss.. hehe :P

~ Kelas Tamat ~

Weekly Reflection 3

Selama 4 jam berada di kelas FOP (^_^)

8/2/2011
Starting blajar ulangkaji chapter 1& 2.
Buat exercise dlm class chapter 1& 2 tentang Flowchart dan coding (Programming C++)
Buat dalam class then attach pd FORUM then reply pada Miss Ayuni.
After that doing the homework 1& 2 and attach pada Forum too.
After all finished,we can go back now!!



Yg hadir:Daus,Anne & Eka

*yg tak datang: wany,thana & nozy.*

schazy

Posts: 9
Join date: 31/01/2011

~ Kelas Tamat ~

Weekly Reflection 2

Selama 4 jam berada di kelas FOP (^_^)

- Buat blogspot & register forum.
- Menjawab latihan yg miss bagi dlm forum.
- Submit kerja rumah yg ada dlm forum.
- Miss ajar chapter 2.
- Contoh :

#include ---------->header
main()---------->body
{

return 0;
}

- Setiap kumpulan diberi soalan dan markah.
- Kami mendapat 3 markah sajew :'(
-

WE HAVE TO IMPROVE OURSELF (^_^)

~ Kelas Tamat ~

Sunday, February 27, 2011

Weekly Reflection 1

Selama 4 jam berada di kelas FOP (^_^)

- Orientasi berkenalan sesame classmate (Malu²).
- Rehat 15 minit utk breakfast (Lapar²).
- Kami dibahagikan kpd beberapa kumpulan (Wakarima).
- FORUM : Bincang pendapat masing-masing (Ilham²).
- Weekly reflection menerangkan apa yg kita buat dlm masa 4 jam semasa di dlm kelas.
- Zip file diberi 5 markah(4 assignment)x gune paper.
- Buat blog samada blogspot.com/wordpress(10).
- Midterm 10 markah.
- Final 40 markah.
- URL , address : uttp://www.facebook.com
- Pengenalan subjek chapter 1.
- Kita belajar chapter 1 : algorithm , psedocode , flowchart .
- Algorithm : Ayatnye panjang (Bak kata Miss Ayuni) .
- Pseudo code : Bentuk pergerakkan program.
- Flowchart :
- Aktiviti : Setiap kumpulan musti selesai dan tulis di whiteboard , soalan yg miss bagi (Chaiyok!!).

- Kelas Tamat -

Friday, February 4, 2011

Pengenalan FOP

Hoyeh Hoyeyh.. bermulanya kelas FOP . ktokk ktokkk , aku mengetuk pintu . OMG !! Miss Ayuni da macok kelas.. aku lewat !!! fuh , nasib baik xde pape berlaku , hee . 1st time dalam kelas FOP , ada sesi perkenalan diri . malu woo . 2nd , kene buad group . haiyaa , dalam group aku , aku sorang laki , len sume pompuan . segan ouh.. nama group wakenabeb wakarima & diketuai oleh Anne . aku xtau pew maksud wakarima . dis is 1st time in my life I heard dat name (hanco english aku) HAHA .

lima minit kemudian , Miss bitau 6 benda wajib iaituu :
  1. forum
  2. weekly reflection (lepas tamat kelas)
  3. zip file (outcome 1 , 2 , 3 , 4)
  4. blog [blogspot.com , wordpress.com (10m)]
  5. midterm (10m)
  6. final (40m)
aiyoyoo , poning2 . tp xpew , semangatku xkan luntur begitu sajew , bak kata pepatah inggeris "life must be go on" , ngeh3 . aku dapat tau pasal search engine terhebat yg merangkumi sume search2 engine yg ada iaitu master search , heheh . lagi 1 pasal software yg aku akan guna utk wat FOP nanti turbo c++ , borland c++ , visual c++. aku x bape tau sgt pasal benda alah nie -.-"

after that , kitorang pon belajar laa bab 1 pasal algorithm , pseudocode & flow chart . aku penah belajar dulu masa subjek PPSC tp ingat2 lupe arh , hahaha ! yg aku tau algorithm ada nombor step by step . pseudocode pulak kene amek keyword drpd algorithm . flow chart ada kene hafal bentuk2 carta alir . pastu group kitorang (wakarima) kene wat pasal celcius convert to farenheit kat whiteboard .

lupe na bitau , FOP bermaksud Fundamentals of Programming . meow meoww , hehehe ~