lets assume that in real life, you must be riding a skateboard to do a trick.
import java.util.*;
public class tuna{
String brand;
Boolean isOn = false, isMoving = false;
Random r = new Random();
int trickChance = 0;
public tuna(String brand){
this.brand = brand;
}
public void getOn(){
System.out.println("You get on the skateboard.");
isOn = true;
}
public void ride(){
if(isOn == true){
System.out.println("You ride the skateboard.");
isMoving = true;
}
else
System.out.println("You must be on the skateboard first.");
}
public void ollie(){
if(isMoving == true){
trickChance = 1 + r.nextInt(100);
if(trickChance < 90){
System.out.println("You successfully ollie!");
}else{
System.out.println("You try to ollie and crash.");
}
}
else{
System.out.println("You must be riding the skateboard to do a trick.");
}
}
public void kickFlip(){
if(isMoving == true){
trickChance = 1 + r.nextInt(100);
if(trickChance < 75){
System.out.println("You successfully kick flip!");
}else{
System.out.println("You try to kick flip and crash.");
}
}
else{
System.out.println("You must be riding the skateboard to do a trick.");
}
}
public void popShoveit(){
if(isMoving == true){
trickChance = 1 + r.nextInt(100);
if(trickChance < 80){
System.out.println("You successfully perform a pop shove it!");
}else{
System.out.println("You try to perform a pop shove it and crash.");
}
}
else{
System.out.println("You must be riding the skateboard to do a trick.");
}
}
}
Edited by Cruel Hand, 07 December 2011 - 12:20 PM.
spelling error


Sign In
Create Account


Back to top









