Advertisement
Guest User

Untitled

a guest
Nov 22nd, 2010
206
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.95 KB | None | 0 0
  1.  /*
  2.  * To change this template, choose Tools | Templates
  3.  * and open the template in the editor.
  4.  */
  5.  
  6. package ojectoriented;
  7.  
  8. /**
  9.  *
  10.  * @author Utilizador
  11.  */
  12. public class Main {
  13.  
  14.     /**
  15.      * @param args the command line arguments
  16.      */
  17.     public static void main(String[] args) {
  18.         // TODO code application logic here
  19.     class bike {
  20.         int cadence = 0;
  21.         int speed = 0;
  22.         int gear = 1;
  23.  
  24.         void changecadence(int newValue) {
  25.             cadence = newValue;
  26.         }
  27.  
  28.         void speedUp(int increment) {
  29.             speed = speed + increment;
  30.         }
  31.         void BrackesOn(int decrement) {
  32.             gear = speed - decrement;
  33.         }
  34.         void changegear ( int newValue) {
  35.             gear = newValue;
  36.          }
  37.         void printStates() {
  38.             System.out.println("cadence:"+cadence+"
  39.                                speed:"+speed+" gear:"+gear);
  40.         }
  41.        
  42.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement