diff --git a/car.c b/car.c index 009fb86..4a1bb9d 100644 --- a/car.c +++ b/car.c @@ -1,9 +1,15 @@ -*---------------------------------------------------------- +/*---------------------------------------------------------- * HTBLA-Leonding * --------------------------------------------------------- - * Author: */ ; /* + * Author: Marc Tismonar * ---------------------------------------------------------- * Description: * Implementation of car.h. * ---------------------------------------------------------- */ +#include "car.h" + +Car get_car(CarType carType) { + Car car = {carType, RED, 0.0, 0.0, 0}; + return car; +} \ No newline at end of file diff --git a/car.h b/car.h index 9fe0554..09b462c 100644 --- a/car.h +++ b/car.h @@ -1,10 +1,31 @@ /*---------------------------------------------------------- * HTBLA-Leonding * --------------------------------------------------------- -* Author: */ ; /* +* Author: Marc Tismonar * ---------------------------------------------------------- * Description: * Car abstract data type demo. * ---------------------------------------------------------- */ +typedef struct CarImplementation* Car; +typedef enum { AIXAM, FIAT_MULTIPLA, JEEP } CarType; +typedef enum { RED, GREEN, BLUE, ORANGE, SILVER, BLACK } Color; + +struct CarImplementation { + CarType type; + Color color; + double fill_level; + double acceleration_rate; + int speed; +}; + +Car get_car(CarType type); +CarType get_type(Car car); +Color get_color(Car car); +double get_fill_level(Car car); +double get_acceleration_rate(Car car); +int get_speed(Car car); +void set_acceleration_rate(Car car, double acceleration_rate); +void accelerate(Car car); +void init(); \ No newline at end of file diff --git a/car_main_driver.c b/car_main_driver.c index 81d9411..1bd4217 100644 --- a/car_main_driver.c +++ b/car_main_driver.c @@ -1,14 +1,14 @@ /*---------------------------------------------------------- * HTBLA-Leonding * --------------------------------------------------------- - * Author: */ ; /* + * Author: Marc Tismonar * ---------------------------------------------------------- * Description: * Car demo project. * ---------------------------------------------------------- */ -#include +#include int main(int argc, char const *argv[]) { /* your code */