changed header & added my name

This commit is contained in:
MarcUs7i 2024-11-14 15:11:05 +01:00
parent 234764fe1b
commit aae3fcf4fd
3 changed files with 32 additions and 5 deletions

10
car.c
View file

@ -1,9 +1,15 @@
*---------------------------------------------------------- /*----------------------------------------------------------
* HTBLA-Leonding * HTBLA-Leonding
* --------------------------------------------------------- * ---------------------------------------------------------
* Author: */ <my name>; /* * Author: Marc Tismonar
* ---------------------------------------------------------- * ----------------------------------------------------------
* Description: * Description:
* Implementation of car.h. * Implementation of car.h.
* ---------------------------------------------------------- * ----------------------------------------------------------
*/ */
#include "car.h"
Car get_car(CarType carType) {
Car car = {carType, RED, 0.0, 0.0, 0};
return car;
}

23
car.h
View file

@ -1,10 +1,31 @@
/*---------------------------------------------------------- /*----------------------------------------------------------
* HTBLA-Leonding * HTBLA-Leonding
* --------------------------------------------------------- * ---------------------------------------------------------
* Author: */ <my name>; /* * Author: Marc Tismonar
* ---------------------------------------------------------- * ----------------------------------------------------------
* Description: * Description:
* Car abstract data type demo. * 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();

View file

@ -1,14 +1,14 @@
/*---------------------------------------------------------- /*----------------------------------------------------------
* HTBLA-Leonding * HTBLA-Leonding
* --------------------------------------------------------- * ---------------------------------------------------------
* Author: */ <my name>; /* * Author: Marc Tismonar
* ---------------------------------------------------------- * ----------------------------------------------------------
* Description: * Description:
* Car demo project. * Car demo project.
* ---------------------------------------------------------- * ----------------------------------------------------------
*/ */
#include<stdio.h> #include <stdio.h>
int main(int argc, char const *argv[]) { int main(int argc, char const *argv[]) {
/* your code */ /* your code */