Mohamad Afiza 1 Report post Posted September 1, 2010 (edited) Tolong saya membuat program ini Turbo C++ 4.5, setidak-tidaknya bagi petunjuk sikit-sikit, terima kasih banyak2; User will enter car type and package of car based on the following; ------------------------------- TYPE...PACKAGE..PRICE.........TAX _______________________________ CAR1.......a............24000.........150% .................b............28000.........150% _______________________________ CAR2........c............35000.........200% .................d............37000.........200% .................e............41000.........200% ------------------------------- This program will calculate new price for the type of cars after being taxed. This program will display type of car, package and the price that has to paid by the customer. This program will continue until user request to stop. At the end; the program will display: -number of customer for CAR1 type -number of customer for CAR2 type -total sales for CAR1 type -total sales for CAR2 type -total sales for all cars Soalan penuh: [IMG]http://i291.photobucket.com/albums/ll311/afizaex/Awam/ass.jpg[/IMG] Edited September 6, 2010 by Mohamad Afiza Quote Share this post Link to post Share on other sites
akuccputsedut 147 Report post Posted September 1, 2010 rasa cam soalan assignment nih... hang try korek dalam Putera nih.. aku rasa ada jawapan laa... hihihihi Quote Share this post Link to post Share on other sites
KeH 15 Report post Posted September 1, 2010 mmg soklan assignemnt ni xpon paper last ear. walopon aku dh 4 tahun tggal rasa ingat lagi. 1.declare sume variable2 yg ade, dynamic dan constant. 2.buat soklan,pastu kasi la option jawapan..ni buat guna nested if else 3.ulang step 2 sampai sume jawapan tu dapat 4.print result 5.alahai senang sgt ni bace blk buku tu Quote Share this post Link to post Share on other sites
Mohamad Afiza 1 Report post Posted September 1, 2010 [quote name='KeH' date='01 September 2010 - 02:17 PM' timestamp='1283321849' post='1046782'] mmg soklan assignemnt ni xpon paper last ear. walopon aku dh 4 tahun tggal rasa ingat lagi. 1.declare sume variable2 yg ade, dynamic dan constant. 2.buat soklan,pastu kasi la option jawapan..ni buat guna nested if else 3.ulang step 2 sampai sume jawapan tu dapat 4.print result 5.alahai senang sgt ni bace blk buku tu [/quote] Masalahnya kat last program tu mcm mana nak display total semua tu? Quote Share this post Link to post Share on other sites
KeH 15 Report post Posted September 1, 2010 cube paste sini code yg ko dah buat tu Quote Share this post Link to post Share on other sites
akuccputsedut 147 Report post Posted September 1, 2010 [quote name='Mohamad Afiza' date='01 September 2010 - 03:37 PM' timestamp='1283326652' post='1046790'] Masalahnya kat last program tu mcm mana nak display total semua tu? [/quote] adik minta paste kan code yang dah buat separuh jalan tuh nak tgk kat mana stuck... Quote Share this post Link to post Share on other sites
Mohamad Afiza 1 Report post Posted September 2, 2010 code pengiraan tax semua OK,cuma tak tau nak buat code utk display final result iaitu "total customer" yg membeli utk setiap jenis kereta dan seterusnya.. p/s:Saya tak dpt paste code tu sekarang sbb saya guna handphone utk masuk forum ni Quote Share this post Link to post Share on other sites
Mohamad Afiza 1 Report post Posted September 6, 2010 [quote name='Mohamad Afiza' date='03 September 2010 - 12:30 AM' timestamp='1283445012' post='1046954'] code pengiraan tax semua OK,cuma tak tau nak buat code utk display final result iaitu "total customer" yg membeli utk setiap jenis kereta dan seterusnya.. p/s:Saya tak dpt paste code tu sekarang sbb saya guna handphone utk masuk forum ni [/quote] sekarang dah boleh paste, saya cuma tak boleh nak display 3 benda lagi: -total sales for Compact type -total sales for Sedan type -total sales for all cars Di bawah code yg saya dah berjaya buat, 3 benda lagi....: [code]#include <iostream.h> void main() { char loop, type, package; float price, tax, total; int compact=0, sedan=0, compact_all; do { cout << "\nChoose type: (C) COMPACT or (S) SEDAN =" << endl; cin >> type; if (type=='C') { cout << "Choose package: (a) Standard, ( Limited edition = " << endl; cin >> package; compact=compact+1; if (package=='a') { price=24000; tax=price*1.5; } else if (package=='b') { price=28000; tax=price*1.5; } else { cout << "Error" << endl; } } else if(type=='S') { cout << "Choose package: (a) Standard, ( Sporty, (c) Limited edition = " << endl; cin >> package; if (package=='a') { price=35000; tax=price*2; } else if (package=='b') { price=37000; tax=price*2; } else if (package=='c') { price=41000; tax=price*2; } else { cout << "Error" << endl; } } else { cout << "Error" << endl; } total=price+tax; cout << "Total price: RM" << total << endl; cout << "\n Do you want to stop? (Y/N): "; cin >> loop; } while (loop!='Y'); if ((type=='C') && (loop=='N')) compact_all=compact+0; cout << "Number of Compact customers: " << compact << endl; }[/code] Quote Share this post Link to post Share on other sites
zeph 1 Report post Posted September 7, 2010 alamak.. ko belajar kat sekolah mana ni? tolong sarankan kepada fakulti sekolah ko guna modern c++ compiler/ide mcm http://www.codeblocks.org/ tak pun visual c++ express edition. Quote Share this post Link to post Share on other sites
Mohamad Afiza 1 Report post Posted September 7, 2010 [quote name='zeph' date='07 September 2010 - 10:21 AM' timestamp='1283826091' post='1047395'] alamak.. ko belajar kat sekolah mana ni? tolong sarankan kepada fakulti sekolah ko guna modern c++ compiler/ide mcm http://www.codeblocks.org/ tak pun visual c++ express edition. [/quote] Dah siap dah program ni, orang kat sini lambat sangat respon. Bukan sekolah tapi UiTM. Kalau Windows 7 64 bit tak compactible dgn program ni. Quote Share this post Link to post Share on other sites
akuccputsedut 147 Report post Posted September 7, 2010 [quote name='Mohamad Afiza' date='07 September 2010 - 01:25 PM' timestamp='1283837105' post='1047411'] Dah siap dah program ni, orang kat sini lambat sangat respon. Bukan sekolah tapi UiTM. Kalau Windows 7 64 bit tak compactible dgn program ni. [/quote] tahniah sebab dah siap.. aku tau hang dapat jawapan dari mana... takper.. no harm.. learn from mistake yer adik... orang2 kat sini semua busy2.. maybe tak berapa sempat nak tolong hang siapkan assignment hang tuh... okies... harap maklum.. dan kalau tak keberatan boleh ler letak solution kat sini... boleh jadi rujukan untuk orang lain.. kalau takmo kongsi ilmu.. terpulang.. tepuk dada tanya minda... P/S: jap gi aku suh orang tutup topik nih... Quote Share this post Link to post Share on other sites
otai_g 3 Report post Posted September 8, 2010 lenkali kalo nak cepat emel kan aku soalannya k. 100% working.tp mcm paria sikit la codingnya [code] #include <iostream> using namespace std; void main() { char type, package, loop; double nprice, tsalec = 0, tsales = 0; int tcarc = 0, tcars = 0; do { cout<<"Choose type (c) COMPACT or (s) SEDAN : "; cin>>type; if (type == 'c') { tcarc = tcarc++; cout<<"Choose package (a) Standard, ( Limited edition : "; cin>>package; if (package == 'a') { nprice = 24000 + (24000*1.5); tsalec = tsalec + nprice; cout<<"Type : compact Package : Standard Price : "<<nprice<<endl; } else if (package == 'b') { nprice = 28000 + (28000*1.5); tsalec = tsalec + nprice; cout<<"Type : compact Package : Limited Price : "<<nprice<<endl; } else { cout<<"Error input!"; tcarc = tcarc--; } } else if (type == 's') { tcars = tcars++; cout<<"Choose package (a) Standard, ( Sporty, (c) Limited edition : "; cin>>package; if (package == 'a') { nprice = 35000 + (35000*2); tsales = tsales + nprice; cout<<"Type : sedan Package : Standard Price : "<<nprice<<endl; } else if (package == 'b') { nprice = 37000 + (37000*2); tsales = tsales + nprice; cout<<"Type : sedan Package : Sporty Price : "<<nprice<<endl; } else if (package == 'c') { nprice = 41000 + (41000*2); tsales = tsales + nprice; cout<<"Type : sedan Package : Limited Price : "<<nprice<<endl; } else { cout<<"Error input!"; tcars = tcars--; } } cout<<endl<<"Do you want to stop? (y/n) : "; cin>>loop; } //tutup do while (loop == 'n'); cout<<endl<<"Jumlah pembeli kereta compact : "<<tcarc<<endl; cout<<"Jumlah jualan kereta compact : RM "<<tsalec<<endl; cout<<"Jumlah pembeli kereta sedan : "<<tcars<<endl; cout<<"Jumlah jualan kereta sedan : RM "<<tsales<<endl; cout<<"Jumlah jualan semua kereta : RM "<<tsalec + tsales<<endl; } //close main [/code] Quote Share this post Link to post Share on other sites
Mohamad Afiza 1 Report post Posted September 9, 2010 OK,walaupun dah siap,tapi terima kasih sebab membantu! Selamat hari raya. Quote Share this post Link to post Share on other sites
otai_g 3 Report post Posted September 14, 2010 (edited) another one tamil naidu punya coding [code] #include <iostream> using namespace std; class kereta { private: char type, package;; int tcarc, tcars; double tsalec, tsales; public: void input(); void output(); }; void kereta::input() { char loop; double nprice; tcarc=0; tcars=0; tsalec=0; tsales=0; for (; { cout<<"Choose type (c) COMPACT or (s) SEDAN : "; cin>>type; if (type == 'c') { tcarc = tcarc++; cout<<"Choose package (a) Standard, ( Limited edition : "; cin>>package; if (package == 'a') { nprice = 24000 + (24000*1.5); tsalec = tsalec + nprice; cout<<"Type : compact Package : Standard Price : "<<nprice<<endl; } else if (package == 'b') { nprice = 28000 + (28000*1.5); tsalec = tsalec + nprice; cout<<"Type : compact Package : Limited Price : "<<nprice<<endl; } else { cout<<"Error input!"; tcarc = tcarc--; } } else if (type == 's') { tcars = tcars++; cout<<"Choose package (a) Standard, ( Sporty, (c) Limited edition : "; cin>>package; if (package == 'a') { nprice = 35000 + (35000*2); tsales = tsales + nprice; cout<<"Type : sedan Package : Standard Price : "<<nprice<<endl; } else if (package == 'b') { nprice = 37000 + (37000*2); tsales = tsales + nprice; cout<<"Type : sedan Package : Sporty Price : "<<nprice<<endl; } else if (package == 'c') { nprice = 41000 + (41000*2); tsales = tsales + nprice; cout<<"Type : sedan Package : Limited Price : "<<nprice<<endl; } else { cout<<"Error input!"; tcars = tcars--; } } cout<<endl<<"Do you want to stop? (y/n) : "; cin>>loop; if (loop == 'y') break; } //tutup for } void kereta::output() { cout<<endl<<"Jumlah pembeli kereta compact : "<<tcarc<<endl; cout<<"Jumlah jualan kereta compact : RM "<<tsalec<<endl; cout<<"Jumlah pembeli kereta sedan : "<<tcars<<endl; cout<<"Jumlah jualan kereta sedan : RM "<<tsales<<endl; cout<<"Jumlah jualan semua kereta : RM "<<tsalec + tsales<<endl; } void main() { kereta samdol; samdol.input(); samdol.output(); } [/code] Edited September 14, 2010 by otai_g Quote Share this post Link to post Share on other sites