Simulation of fuel purchases.
Declaration
Liter: integer;
Uang (money): integer;
Type of fuel: String;
Description
Read (Liter);
Options Liter
1. 1 Liter 6500
2. 2 Liter 13000
3. 3 Liter 19500
4. 4 Litre 26000
End {select}
Write {L}
Program
# include (iostream)
Class fuel {
Private:
int output;
int liter;
Public:
void input ();
void process ();
void output ();
};
void fuel:: insert () {
cout <<"enter the price of fuel:";
cin>> output;
cout <<"type of fuel:"; cin>> output;
}
void fuel:: process () {
output = liter * money
}
void fuel:: output () {
cout <<"the output of the process:" <<result;
}
int main (int argc, char * argv []) {
Fuel X;
X input ();
X process ();
X output ();
System ("pause");
Return exit_success;
}/ * Import to jeliot: * /
{Public class fuel
void static void input ();
void static void process ();
void static void output ();
private int output;
private int liter;
};
Public void input();{
system.out.print ("enter the price of fuel")
output = input.readint ();
system.out.print ("type of fuel");
output = input.readint ();
}
Public void process () {
output = liter * money
}
Public void output () {
system.out.print ("output of the process : " + result);
}
Public static void main () {
X = new fuel fuel ();
X.input ();
X.procces ();
X.output ();
} }
Tidak ada komentar:
Posting Komentar