Skip to content

Instantly share code, notes, and snippets.

@wilderwith
Created October 23, 2019 12:26
Show Gist options
  • Save wilderwith/155512d71775d103d0a0311bd14d6e09 to your computer and use it in GitHub Desktop.
Save wilderwith/155512d71775d103d0a0311bd14d6e09 to your computer and use it in GitHub Desktop.
projet
public class StercketBattle {
public static String Sterckets(String[] args) {
public class Stercket {
// Attributs
private String name;
private int attackScore;
private int defenseScore;
private boolean victory;
private double type;
private double rank;
private int lifePoints;
// Méthodes
public Car(String name, int attackScore, int defenseScore, boolean victory, double type, double rank, int lifePoint)
{
// J'appelle le contructeur à 4 parametres
this(color,brand,doorsNumber,10,180);
}
public Car(String name, int attackScore, int defenseScore, boolean victory, double type, double rank, int lifePoint)
{
this.color = color;
this.brand = brand;
this.doorsNumber = doorsNumber;
stopped = true;
type = 0.0;
this.acceleration = acceleration;
this.size = size;
thePilot = null;
}
public void print()
{
if(thePilot != null)
{
System.out.print(thePilot.getName() + " drive a ");
}
System.out.println(color + " " + brand + " with " + doorsNumber + " door(s)");
if(stopped)
{
System.out.println("It is stopped");
}
else
{
System.out.println("It's running at " + speed + " mph");
}
}
public void start()
{
stopped = false;
}
public void accelerate()
{
if(!stopped)
{
speed += acceleration;
}
}
public void brake()
{
speed -= acceleration;
if(speed < 0)
{
speed = 0;
}
}
public boolean setPilot(Pilot aPilot)
{
// Si la voiture est assez grande, il peut rentrer
if (aPilot.getHeight() <= size)
{
thePilot = aPilot;
return true;
}
// Sinon
return false;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment