Answered step by step
Verified Expert Solution
Link Copied!
Question
1 Approved Answer

7.5 LAB 1-1: Simple car Given two integers that represent the miles to drive forward and the miles to drive in reverse as user


 

image text in transcribed

image text in transcribedimage text in transcribed

image text in transcribed

7.5 LAB 1-1: Simple car Given two integers that represent the miles to drive forward and the miles to drive in reverse as user inputs, create a SimpleCar variable that performs the following operations: Drives input number of miles forward Drives input number of miles in reverse Honks the horn Reports car status SimpleCar.h contains the struct definition and related function declarations. SimpleCar.c contains related function definitions. Ex: If the input is: 100 4 the output is: beep beep Car has driven: 96 miles LAB ACTIVITY 7.5.1: LAB 1-1: Simple car 1 #include 2 3 #include "SimpleCar.h" 4 5 int main() { 6 7 | 8 return 0; 9 } Current file: main.c 0/10 Load default template... File is marked as read only 1 typedef struct SimpleCar_struct { 2 int miles; 3 } SimpleCar; 4 5 SimpleCar InitCar(); Current file: SimpleCar.h 6 SimpleCar Drive (int dist, SimpleCar car); 7 SimpleCar Reverse (int dist, SimpleCar car); 8 int GetOdometer (SimpleCar car); 9 void HonkHorn(SimpleCar car); 10 void Report (SimpleCar car); 11 | File is marked as read only 1 #include 2 3 #include "SimpleCar.h" 4 5 SimpleCar InitCar() { 6 SimpleCar newCar; 7 8 newCar.miles = 0; Current file: SimpleCar.c 9 10 11} 12 return newCar; 13 SimpleCar Drive (int dist, SimpleCar car){\ 14 15 16 17} 18 car.miles = car.miles + dist; return car; 19 Simple Car Reverse (int dist, SimpleCar car){ 20 21 22 23 } 24 car.miles = car.miles return car; dist; 25 int GetOdometer (SimpleCar car){ 26 27} 28 return car.miles; 29 void HonkHorn(SimpleCar car){ 30 31 } 32 printf("beep beep "); 33 void Report (SimpleCar car){ 34 printf("Car has driven: %d miles ", car.miles); 35}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

To complete the code for the SimpleCar program using the given structure and functions you can imple... blur-text-image
Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Guide To Client Server Databases

Authors: Joe Salemi

2nd Edition

1562763105, 978-1562763107

More Books

Students explore these related Databases questions