PASTEBIN
| #1 paste tool since 2002
create new paste
tools
api
archive
real-time
faq
PASTEBIN
create new paste
trending pastes
sign up
login
my settings
my profile
Public Pastes
Untitled
0 sec ago
Share-Online Premi...
19 sec ago
FEB 23 Brazzers,Vi...
24 sec ago
Untitled
19 sec ago
Compte Premium Min...
1 min ago
config
26 sec ago
What mobile networ...
27 sec ago
can we play audio ...
33 sec ago
Aldian
By: a guest on Jul 5th, 2009 | syntax:
Java
| size: 1.06 KB | hits: 194 | expires: Never
download
|
raw
|
embed
|
report abuse
Copied
public
class
VaisseauSpatial
{
String
nom
=
null
;
String
couleur
=
"bleu"
;
int
nombre_de_canons
=
3
;
int
vitesse
=
0
;
static
int
nombre_vaisseaux
=
0
;
VaisseauSpatial
(
String
nom
)
{
nombre_vaisseaux
++;
this
.
nom
=
nom
;
}
VaisseauSpatial
(
String
nom,
String
couleur,
int
nombre_de_canons
)
{
this
(
nom
)
;
this
.
couleur
=
couleur
;
this
.
nombre_de_canons
=
nombre_de_canons
;
}
void
accelerer
(
)
{
vitesse
++
;
System
.
out
.
println
(
"le vaisseau "
+
nom
+
" accélère et sa vitesse passe à: "
+
vitesse
)
;
}
void
ralentir
(
)
{
vitesse
--
;
if
(
vitesse
<
0
)
vitesse
=
0
;
System
.
out
.
println
(
"le vaisseau "
+
nom
+
" déccélère et sa vitesse passe à: "
+
vitesse
)
;
}
public
static
void
main
(
String
[
]
args
)
{
VaisseauSpatial vaisseau1
=
new
VaisseauSpatial
(
"Liberty"
)
;
VaisseauSpatial vaisseau2
=
new
VaisseauSpatial
(
"Emeraude"
,
"rouge"
,8
)
;
vaisseau1.
accelerer
(
)
;
vaisseau2.
accelerer
(
)
;
vaisseau1.
ralentir
(
)
;
System
.
out
.
println
(
"Il y a actuellement "
+
nombre_vaisseaux
+
" vaisseaux dans l'espace"
)
;
}
}
create a
new version
of this paste
RAW Paste Data