Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

how to write the coding problem 6 As a programmer you are required to write a C program which calculates the displacement for a car

how to write the coding
image text in transcribed
image text in transcribed
problem 6 As a programmer you are required to write a C program which calculates the displacement for a car which is waiting at a stoplight. When the light finally turns green, the car will accelerate with different rates of acceleration and duration of time. The formula for calculating the displacement: d=vit+21at2 where d = displacement, v= velocity, a= acceleration, t= time taken a. Define vi as INITVEL =0.0 as symbolic constant. b. Use the math built in function to calculate the square (i.e. t2 ). c. Create the following 4 user-defined functions: - Getcarinfo () Gets the car colour and model from the user. Prints the car colour and model from this function as shown in the sample output. - GetInput() Gets an input from user and returns a value to main(). This function will be called twice to get the acceleration and time. - GetDisplacement () Accepts the values of acceleration and duration of time from main (). Calculates and returns the displacement value. - Dispresult() Accepts the displacement value and prints the result. Sample output: Enter car model: Proton Enter car colour: Black This program will calculate displacement of Black Proton Enter car's acceleration (meter/ (seconds*seconds) : 10 Enter the time taken for the car to accelerate (seconds) : 4 The displacement of the car: 80.00 meter Press any key to continue

Step by Step Solution

There are 3 Steps involved in it

Step: 1

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

Step: 3

blur-text-image

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

Fundamentals Of Database Systems

Authors: Ramez Elmasri, Sham Navathe

4th Edition

0321122267, 978-0321122261

Students also viewed these Databases questions