Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

MTS 3013 Asg1

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 5

ASSIGNMENT 1 PROBLEM ANALYSIS Input = = pay rate per hour total number of hour worked in a week

Process #Income before taxes= pay rate per hour *total hour #Income after taxes= Income before taxes-( Income before taxes * 0.14) #Money spend on clothes and other accessories= income after taxes*0.10 #Money spend on school supplies= Income after taxes *0.01 #Money spend to buy saving bonds= Income before taxes-Money spend on clothes and other accessories- Money spend on school supplies #Balance money= Money spend to buy saving bonds*0.25 #Money parents spend to buy additional saving bonds = Balance Money*0.50 Output =Income before taxes = Income after taxes = Money spend on clothes and other accessories = Money spend on school supplies = Money spend to buy saving bonds = Money parents spend to buy additional saving bonds

START

FLOW CHART

INPUT PAY RATE PER HOUR TOTAL NUMBER OF HOURS WORKED

PROCESS i_before= payrate_hour*totalhours i_after= i_before-(i_before*0.14) c_accessories= i_after*0.10 school_supp= i_after*0.01 sav_bonds= i_after-c_accessories-school_supp balance =sav_bonds*0.25 add_savbonds = sav_bonds *0.50

Output Income before taxes Income after taxes Money spend on clothes and accessories Money spend on school supplies Money spend to buy saving bonds Money parents spend to buy additional saving bonds

END

PROGRAM /************************************************************\ *Aturcara untuk mengira pendapatan dan perbelanjaan * *serta jumlah wang yang dibelanjakan oleh ibubapa anda * *untuk membeli simpanan tambahan untuk anda * *yang telah bekerja ketika cuti musim panas * * selama satu minggu * \************************************************************/ #include<iostream.h> void main() { float payrate_hour,i_before,i_after,c_accessories; float school_supp,balance,sav_bonds,add_savbonds; //Pengisytiharan int totalhours; //Pengisytiharan cout<<"\t\t*******SUMMER HOLIDAY FINANCIAL*******\n"<<endl; cout<<"\t\tPAY RATE PER HOUR:"; cin>>payrate_hour; //Membaca kadar bayaran sejam cout<<endl; cout<<"\t\tTOTAL HOURS WORKED FOR THE WHOLE WEEK:"; cin>>totalhours; //Membaca jumlah jam bekerja dalam seminggu cout<<endl; i_before=payrate_hour*totalhours; i_after=i_before-(i_before*0.14); c_accessories=i_after*0.10; school_supp=i_after*0.01; sav_bonds=i_after-c_accessories-school_supp; balance=sav_bonds*0.25; add_savbonds=balance*0.50;

cout<<"\t\t################################################### ##########"<<endl; cout<<"\t\t# #"<<endl; cout<<"\t\tINCOME BEFORE TAXES:RM"<<i_before<<endl; //Paparkan pendapatan sebelum tax

cout<<endl; cout<<"\t\tINCOME AFTER TAXES :RM"<<i_after<<endl; //Paparkan pendapatan selepas tax cout<<endl; cout<<"\t\tMONEY SPEND ON CLOTHES AND ACCESSORIES :RM"<<c_accessories<<endl; //Paparkan perbelanjaan //untuk pakaian dan perhiasan cout<<endl; cout<<"\t\tMONEY SPEND ON SCHOOL SUPPLIES :RM"<<school_supp<<endl; //Paparkan perbelanjaan untuk //peralatan sekolah cout<<endl; cout<<"\t\tMONEY SPEND ON BUYING SAVING BONDS :RM"<<sav_bonds<<endl; //Paparkan jumlah wang digunakan untuk membeli simpanan cout<<endl; cout<<"\t\tMONEY PARENTS SPEND TO BUY ADDITIONAL SAVING BONDS:RM"<<add_savbonds<<endl<<endl; //Paparkan jumlah wang yang dibelanjakan cout<<"\t\t# #"<<endl; //oleh ibubapa untuk membeli simpanan bagi pelajar cout<<"\t\t################################################### ##########"<<endl;

}//Atur cara tamat

EXAMPLE OF INPUT AND OUTPUT

Picture 1:An example of input and output.

You might also like