Database System Concepts
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
Bartleby Related Questions Icon
Related questions
Question
Can anyone help me these coding questions
Transcribed Image Text:## Functions with Reference Parameters
In this section, we explore the implementation of a C++ program that utilizes functions with reference parameters to compute and display miles per hour. The program, named `MPH`, reads two real numbers: `miles` and `hours`. It then calculates and outputs `milesPerHour` based on these inputs. A function named `GetData` is responsible for prompting users for the relevant values, processing the inputs, and returning them to the `main` function as reference parameters.
### Code Overview
```cpp
// Program MPH reads miles and hours and prints miles per hour.
#include <iostream>
#include <iomanip>
using namespace std;
/* FILL IN the function prototype for GetData */
int main() {
float miles;
float hours;
float milesPerHour;
cout << fixed << showpoint;
/* FILL IN code to invoke function GetData */
milesPerHour = miles / hours;
cout << setw(10) << miles
<< setw(10) << hours
<< setw(10) << milesPerHour << endl;
return 0;
}
//***********************************************
/* FILL IN the function heading for GetData */
// {
/* FILL IN code to prompt for miles and hours */
/* FILL IN code to read miles and hours */
// }
```
### Exercise 5
The exercise requires filling in the missing components of the program, compiling, and running the program three times using the provided values. Results are to be recorded.
#### Values to Use:
| Miles | Hours | Miles per Hour |
|-------|-------|----------------|
| 120.1 | 2.2 | |
| 332.0 | 5.5 | |
| 1250.0| 20.0 | |
### Instructions
1. **Function Prototype and Definition**: Implement the function prototype and definition for `GetData` to ensure that user prompts and data reading operations are correctly handled.
2. **Invoke GetData Function**: Modify the main function to call `GetData` and pass the necessary parameters by reference.
3. **Compile and Run**: Compile the program and run it using the provided data to verify correctness. Calculate `milesPerHour` and record the results for each set of inputs.
Through this exercise, learners will develop an understanding of how reference parameters work in C++ and how they can be effectively
Expert Solution
Check MarkThis question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
bartleby
This is a popular solution
bartleby
Trending nowThis is a popular solution!
bartleby
Step by stepSolved in 2 steps with 4 images
Knowledge Booster
Background pattern image
Similar questions
- Do you have any personal or anecdotal proof that computers have been important in the classroom for decades?arrow_forwardDo you know anything about Ada Lovelace and the contributions she made to the field of computing?arrow_forwardWhat year did John von Neumann create the first computer?arrow_forward
arrow_back_ios
arrow_forward_ios
Recommended textbooks for you
- Text book imageDatabase System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationText book imageStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONText book imageDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- Text book imageC How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONText book imageDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningText book imageProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education