Declaration
type: char
select: integer
amount: float
L: float
rp: float
Description
if (type = premium / pertamax / diesel and select = rp)
for (a = 0; a <= L; a + = 0.1)
number = (a +0.1) * price
then
write (amount)
endif
endfor
else if (type = premium / pertamax / diesel and select = L)
for (b = 0, b <= L; b + = 500)
number = (b +500) * price
then
write (amount)
endif
endfor
end
Program
# Include <iostream> # Include <conio.h> Fuel class { public:
choice ();
transaction ();
result (); private:
char type;
int select;
float amount, L, rp;}; Fuel:: option () {
court <<"Select the type of fuel \ n";
court <<"Premium: p \ nSolar: s \ nPertamax: x \ n";} Fuel:: transaction () {
do {court <<"Enter the fuel type code:"; cin>> type;}
while ((jenis! = 'p')&&( type! =' s')&&( type! = 'x'));
court <<"\ nJenis Purchasing \ n";
court <<"L: 1 \ pour: 2";
do {court <<"\ nEnter Purchase Type Code:"; cin>> select;}
while ((pilih! = 1) & & (pilih! = 2));
if (select == 1)
{Court <<"\ nBerapa liter? \ N"; cin>> L;}
else
{Court <<"\ nWani Piro? USD."; Cin>> rp;}} Fuel:: result () {
if (type == 'p' & & select == 1) {
for (float a = 0; a <= L; a + = 0.1) {
number = (a +0.1) * 4500;
court <<a +0.1 <<"L" <<"===>" <<"Rp." <<amount <<endl;}
court <<"You have to pay: Rp." <<amount <<endl;}
else if (type == 'p' & & select == 2) {
for (float b = 0, b <rp; b + = 500) {
number = (b +500) / 4500;
court <<"Rp." <<b +500 <<"===>" <<amount <<"L" <<endl;}
court <<"You fill in:" <<amount <<"L" <<endl;} if (type == 's' & & select == 1) {
for (float c = 0; c <L; c + = 0.1) {
number = (c +0.1) * 4500;
court <<c +0.1 <<"L" <<"===>" <<"Rp." <<amount <<endl;}
court <<"You have to pay: Rp." <<amount <<endl;} else if (type == 's' & & select == 2) {
for (float d = 0; d <rp, d + = 500) {
number = (d +500) / 4500;
court <<"Rp." <<d +500 <<"===>" <<amount <<"L" <<endl;}
court <<"You fill in:" <<amount <<"L" <<endl;} if (type == 'x' & & select == 1) {
for (float e = 0, e <L, e + = 0.1) {
number = (e +0.1) * 8800;
court <<e +0.1 <<"L" <<"===>" <<"Rp." <<amount <<endl;}
court <<"You have to pay: Rp." <<amount <<endl;} else if (type == 'x' & & select == 2) {
for (float f = 0; f <rp, f + = 500) {
number = (f +500) / 8800;
court <<"Rp." <<f +500 <<"===>" <<amount <<"L" <<endl;}
court <<"You fill in:" <<amount <<"L" <<endl;}} int main () {
Q fuel;
q.choice();
q.Transaction ();
q.results (); getch (); return 0;}
type: char
select: integer
amount: float
L: float
rp: float
Description
if (type = premium / pertamax / diesel and select = rp)
for (a = 0; a <= L; a + = 0.1)
number = (a +0.1) * price
then
write (amount)
endif
endfor
else if (type = premium / pertamax / diesel and select = L)
for (b = 0, b <= L; b + = 500)
number = (b +500) * price
then
write (amount)
endif
endfor
end
Program
# Include <iostream> # Include <conio.h> Fuel class { public:
choice ();
transaction ();
result (); private:
char type;
int select;
float amount, L, rp;}; Fuel:: option () {
court <<"Select the type of fuel \ n";
court <<"Premium: p \ nSolar: s \ nPertamax: x \ n";} Fuel:: transaction () {
do {court <<"Enter the fuel type code:"; cin>> type;}
while ((jenis! = 'p')&&( type! =' s')&&( type! = 'x'));
court <<"\ nJenis Purchasing \ n";
court <<"L: 1 \ pour: 2";
do {court <<"\ nEnter Purchase Type Code:"; cin>> select;}
while ((pilih! = 1) & & (pilih! = 2));
if (select == 1)
{Court <<"\ nBerapa liter? \ N"; cin>> L;}
else
{Court <<"\ nWani Piro? USD."; Cin>> rp;}} Fuel:: result () {
if (type == 'p' & & select == 1) {
for (float a = 0; a <= L; a + = 0.1) {
number = (a +0.1) * 4500;
court <<a +0.1 <<"L" <<"===>" <<"Rp." <<amount <<endl;}
court <<"You have to pay: Rp." <<amount <<endl;}
else if (type == 'p' & & select == 2) {
for (float b = 0, b <rp; b + = 500) {
number = (b +500) / 4500;
court <<"Rp." <<b +500 <<"===>" <<amount <<"L" <<endl;}
court <<"You fill in:" <<amount <<"L" <<endl;} if (type == 's' & & select == 1) {
for (float c = 0; c <L; c + = 0.1) {
number = (c +0.1) * 4500;
court <<c +0.1 <<"L" <<"===>" <<"Rp." <<amount <<endl;}
court <<"You have to pay: Rp." <<amount <<endl;} else if (type == 's' & & select == 2) {
for (float d = 0; d <rp, d + = 500) {
number = (d +500) / 4500;
court <<"Rp." <<d +500 <<"===>" <<amount <<"L" <<endl;}
court <<"You fill in:" <<amount <<"L" <<endl;} if (type == 'x' & & select == 1) {
for (float e = 0, e <L, e + = 0.1) {
number = (e +0.1) * 8800;
court <<e +0.1 <<"L" <<"===>" <<"Rp." <<amount <<endl;}
court <<"You have to pay: Rp." <<amount <<endl;} else if (type == 'x' & & select == 2) {
for (float f = 0; f <rp, f + = 500) {
number = (f +500) / 8800;
court <<"Rp." <<f +500 <<"===>" <<amount <<"L" <<endl;}
court <<"You fill in:" <<amount <<"L" <<endl;}} int main () {
Q fuel;
q.choice();
q.Transaction ();
q.results (); getch (); return 0;}
Tidak ada komentar:
Posting Komentar