Jump to content
Mohamad Afiza

[Help] Tolong Saya Membuat Program

Recommended Posts

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 by Mohamad Afiza

Share this post


Link to post
Share on other sites
rasa cam soalan assignment nih... hang try korek dalam Putera nih.. aku rasa ada jawapan laa... hihihihi

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
[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?

Share this post


Link to post
Share on other sites
[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...

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
[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, (B) 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, (B) 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]

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
[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.

Share this post


Link to post
Share on other sites
[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...

Share this post


Link to post
Share on other sites
lenkali kalo nak cepat emel kan aku soalannya k.
100% working.tp mcm paria sikit la codingnya :blush:

[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, (B) 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, (B) 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]

Share this post


Link to post
Share on other sites
another one tamil naidu punya coding :blush:

[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, (B) 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, (B) 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 by otai_g

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...