This site requires JavaScript, please enable it in your browser!
Greenfoot back

Report as inappropriate.

JoshTimothy
JoshTimothy presents ...

2021/7/10

Car

import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)

/**
* Write a description of class MyWorld here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class MyWorld extends World
{

/**public class Car {

private String make;
private String model;
private int year;
private int speed = 0;
private String engineStatus = "OFF";

//Constructor
public Car() {
System.out.println("A new car is constructed!!");
}

//Entry point to the program
public static void main(String args[]) {
System.out.println("Hurray, you have created your first Java program!!");
Car innovaCar = new Car();
}

public void start() {

if (engineStatus.equals("ON")) {
System.out.println("Kaweropupvlcm pixajfp9ausvp");
} else {
System.out.println("Engine Started");
engineStatus = "ON";
}

}

public void accelerate() {
if (engineStatus.equals("OFF")) {
System.out.println("Engine is off now. Start the engine first");
} else {
speed = speed + 1;
System.out.println("Engine is running at " + speed + "kilometers per hour");
}
}


}
* Constructor for objects of class MyWorld.
*
*/
public MyWorld()
{
// Create a new world with 600x400 cells with a cell size of 1x1 pixels.
super(600, 400, 1);
prepare();
}
/**
* Prepare the world for the start of the program.
* That is: create the initial objects and add them to the world.
*/
private void prepare()
{
}
}

1096 views / 18 in the last 7 days

Tags: game simulation demo

Your browser is ignoring the <APPLET> tag.
JoshTimothyJoshTimothy

2021/7/10

Fantastic!!!

Want to leave a comment? You must first log in, and be a member for more than a week.

Who likes this?

No votes yet.