Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1 // This program converts the speeds 60 kph through 2 // 130 kph (in 10 kph increments) to mph. 3 #include 4 #include 5

1 // This program converts the speeds 60 kph through
2 // 130 kph (in 10 kph increments) to mph.
3 #include
4 #include
5 using namespace std;
6
7 int main()
8 {
9 // Constantsfor the speeds
10 const int START KPH = 60, //Starting speed
11 END_KPH = 130, // Ending speed
12 INCREMENT= 10; // Speed increment
13
14 // Constant for theconversion factor
15 cont doubleCONVERSION_FACTOR = 0.6214;
16
17 // Variables
18 intkph; // To hold speeds in kph
19 doublemph: // To hold speeds inmph
20
21 // Set the numeric outputformatting.
22 cout << fixed <23
24 // Display the tableheadings.
25 cout <<"KPH/tMPH";
26 cout <<"---------------";
27
28 // Display the speeds.
29 for (kph = START_KPH; kph<= END_KPH; kph += INCREMENT)
30 {
31 //Calculate mph
32 mph = kph * CONVERSION_FACTOR;
33
34 // Display the speeds in kph and mph.
35 cout << kph << "t" << mph <36
37 }
38 return 0;
39 }

Program Output
KPH MPH
---------------
60 37.3
70 43.5
80 49.7
90 55.9
100 62.1
110 68.4
120 74.6
130 80.8

****add the following in the code listing****
(a) Conversion from MPH to KPH
(b) conversion factorCONVERSION_FACTOR_M_TO_K = 1.6093
(c) Convert from 20 MPH to 100MPH in 10 MPH increments
(d) Output the results in anadditional table.



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

Computer Performance Engineering 10th European Workshop Epew 2013 Venice Italy September 17 2013 Proceedings

Authors: Maria Simonetta Balsamo ,William Knottenbelt ,Andrea Marin

2013 Edition

3642407242, 978-3642407246

More Books

Students also viewed these Programming questions