Biblioteca Java - Blame information for rev 32
Subversion Repositories:
(root)/Courses and labs samples/ISP/Exemple_ISP_Cluj_2015/ExempleReflexie/src/exemple/reflexie/app/Car.java
Rev | Author | Line No. | Line |
---|---|---|---|
32 | mihai | 1 | |
2 | package exemple.reflexie.app; | ||
3 | |||
4 | /** | ||
5 | * | ||
6 | * @author Mihai Hulea mihai.hulea@aut.utcluj.ro | ||
7 | */ | ||
8 | public class Car { | ||
9 | private int maxSpeed = 0; | ||
10 | private int crtSpeed = 0; | ||
11 | |||
12 | public Car(){ | ||
13 | maxSpeed = 180; | ||
14 | } | ||
15 | |||
16 | public void accelerate(){ | ||
17 | if(crtSpeed<maxSpeed){ | ||
18 | crtSpeed++; | ||
19 | System.out.println("Car accelerate to "+crtSpeed+" km/h"); | ||
20 | }else | ||
21 | System.out.println("Car top speed "+crtSpeed+".Speed limit reached km/h"); | ||
22 | } | ||
23 | |||
24 | private void setSpeedLimit(Integer x){ | ||
25 | maxSpeed = x; | ||
26 | } | ||
27 | |||
28 | public int getCarMaxSpeed(){ | ||
29 | return maxSpeed; | ||
30 | } | ||
31 | |||
32 | public String toString(){ | ||
33 | return "[Car max speed="+maxSpeed+"]"; | ||
34 | } | ||
35 | } |