The Aristocats - Marie

animasi

PPT Pertemuan 4 Kelompok

Senin, 24 Maret 2014

  •  Buat simulasi membeli bahan bakar dengan spesifikasi


  • 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}  


  • Bahasa C++ 
class Fuel { 

      public: 
               void input (); 
               void process ();
               void output (); 
      private: 
                int output; 
                int liter; 
};

void Fuel:: input () {
     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 (); 
}  }

0 komentar:

Posting Komentar