CarSim Docs
Fall 2024
API

# o1.carsim

package o1.carsim

## Members list

### Packages

package o1.carsim.gui

### Type members

#### Classlikes

class Car(val `fuelConsumption`: Double, val `tankSize`: Double, `initialFuel`: Double, `initialLocation`: Pos)

The class `Car` represents virtual cars which can drive about on a surface. A car has a fuel tank that contains gasoline, which is spent as the car moves but can be added using an appropriate method.

The class `Car` represents virtual cars which can drive about on a surface. A car has a fuel tank that contains gasoline, which is spent as the car moves but can be added using an appropriate method.

Although some aspects of a car object are immutable (e.g., fuel consumption rate), some others change (e.g., location, fuel).

## Parameters

fuelConsumption

  the fuel consumption of the new car in liters per 100 km

initialFuel

  the initial amount of fuel in the car’s tank, in liters (at most equal to tank size)

initialLocation

  the starting location of the car

tankSize

  the size of the new car’s fuel tank, in liters

## Attributes

Supertypes
  class Object
  trait Matchable
  class Any

### Value members

#### Concrete methods

def carTest(): Unit

A small program that uses the class `Car`. Students are free to extend and customize it.

A small program that uses the class `Car`. Students are free to extend and customize it.

## Attributes