Question
Develop, compile, and run a C++ program that requires C++ data types, identifiers, variable declarations, comments, program output, and arithmetic operations. Transfer a program to
- Develop, compile, and run a C++ program that requires C++ data types, identifiers, variable declarations, comments, program output, and arithmetic operations.
- Transfer a program to the Unix server, use the G++ compiler to compile a program and execute a c++ program that you have written
Hint: Be sure to watch the putting it all together videos.
Directions:
Using the formula in How to determine the speed of a car by skid marks
(Links to an external site.)
Write a C++ program that asks the user to input the distance the car skidded (in feet) (aka d), and the coefficient of friction) that depends on the road surface and road conditions (aka f). It should display a report similar to the following:
- distance the car skidded (in feet):
120.5 - f:
0.5 - Speed of the car:
42.51 mph
- Call your program CarSpeed.cpp (5 points)
- Include the basic header in your program Header for Assignments.docx
- . (5 points)
- Print a welcome message to the user. (5 points)
- Allow user to input the distance the car skidded (in feet) (aka d), and the coefficient of friction) that depends on the road surface and road conditions (aka f). (5 points)
- Calculate the speed of a car by skid marks and display the results as shown above (10 points) Note: You are required to only display all output to 15 decimal places. You are required to line up the output values.
-
Compile using G++ and test your program on linprog.cs.fsu.edu. (5 points)
(For this step - you must include a copy of the terminal output from a compile and test run as shown below.)
- Include comments in your code as required. (5 points)
- You may assume that all user input will be correct (i.e. numeric entries and valid dimensions). You do not need to handle any situation in which the user enters a negative value, or a letter (Character).
- Remember that dividing two integers from each other produces an integer:
Wrong version:
float ans; int num =2; int denom = 4; ans = num/denom; // ans will be set to 0
Correct version:
float ans; int num =2; int denom = 4; ans = static_cast(num)/denom;
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started