Please fix all the errors thank you.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Please fix all the errors thank you.

## Visual Studio Error List for Week 12 Programming Exercise

In this Visual Studio screenshot, we see the "Error List" panel with a summary of syntax errors encountered in the programming file "Week 12 Programming Exercise.c". Here's a detailed overview:

### Errors Summary

1. **E0020**: `Identifier 'start' is undefined`  
   - **File**: Week 12 Programming Exercise.c  
   - **Line**: 1  

2. **E0065**: `Expected a ';'`  
   - **Line**: 5  

3. **C2061**: `Syntax error: identifier 'Declarations'`  
   - **Line**: 5  

4. **C2059**: `Syntax error: ';'` (Repeated multiple times)  
   - **Lines**: 3, 5, 6, 7, 8, 9, 27

5. **C2061**: `Syntax error: identifier 'miles'`  
   - **Line**: 5  

6. **C2061**: `Syntax error: identifier 'gallons'`  
   - **Line**: 6  

7. **C2061**: `Syntax error: identifier 'mpg'`  
   - **Line**: 7  

8. **C2061**: `Syntax error: identifier 'END_VAL'`  
   - **Line**: 8  

9. **C2143**: ``';' no variable declared before '='``  
   - **Line**: 9  

10. **C2146**: `Syntax error: missing ';' before identifier 'output'`  
    - **Line**: 10  

11. **C2143**: `Syntax error: missing ';' before 'string'`  
    - **Line**: 10  

12. **C2059**: `Syntax error: 'string'`  
    - **Line**: 27  

13. **C2059**: `Syntax error: 'else'`  
    - **Line**: 30  

14. **C1004**: `Unexpected end-of-file found`  
    - **Line**: 33  

### Visual Layout

- **Solution Explorer**: The file "Week 12 Programming Exercise.c" is selected under the 'Source Files' section of
Transcribed Image Text:## Visual Studio Error List for Week 12 Programming Exercise In this Visual Studio screenshot, we see the "Error List" panel with a summary of syntax errors encountered in the programming file "Week 12 Programming Exercise.c". Here's a detailed overview: ### Errors Summary 1. **E0020**: `Identifier 'start' is undefined` - **File**: Week 12 Programming Exercise.c - **Line**: 1 2. **E0065**: `Expected a ';'` - **Line**: 5 3. **C2061**: `Syntax error: identifier 'Declarations'` - **Line**: 5 4. **C2059**: `Syntax error: ';'` (Repeated multiple times) - **Lines**: 3, 5, 6, 7, 8, 9, 27 5. **C2061**: `Syntax error: identifier 'miles'` - **Line**: 5 6. **C2061**: `Syntax error: identifier 'gallons'` - **Line**: 6 7. **C2061**: `Syntax error: identifier 'mpg'` - **Line**: 7 8. **C2061**: `Syntax error: identifier 'END_VAL'` - **Line**: 8 9. **C2143**: ``';' no variable declared before '='`` - **Line**: 9 10. **C2146**: `Syntax error: missing ';' before identifier 'output'` - **Line**: 10 11. **C2143**: `Syntax error: missing ';' before 'string'` - **Line**: 10 12. **C2059**: `Syntax error: 'string'` - **Line**: 27 13. **C2059**: `Syntax error: 'else'` - **Line**: 30 14. **C1004**: `Unexpected end-of-file found` - **Line**: 33 ### Visual Layout - **Solution Explorer**: The file "Week 12 Programming Exercise.c" is selected under the 'Source Files' section of
The image contains a screenshot of a C programming exercise from a development environment. Below is the transcription and explanation:

---

**Week 12 Programming Exercise**

### Program Overview

This program calculates the miles per gallon (mpg) based on user input for miles driven and gallons of gas used. It continues to prompt for these values until a user enters 0 for miles to end the program.

### Code

```c
start

Declarations
    num miles
    num gallons
    num mpg
    num END_VAL = 0

output "How many miles did you drive? Enter 0 to quit."
input miles

// This program continuously prompts a user for miles driven until 0 is entered. 
// While miles are not 0, gallons are entered, and mpg is calculated.
if (miles not END_VAL)
{
    output "How many gallons of gas did you use?"
    input gallons
    mpg = miles / gallons
    output "Your mpg is" + mpg
}
else
{
    output "End of program"
}

stop
```

### Explanation

- **Declarations**: Variables `miles`, `gallons`, `mpg`, and `END_VAL` are declared. `END_VAL` is initialized to 0.
- **Input Prompt**: The user is asked, "How many miles did you drive? Enter 0 to quit."
- **Loop Condition**: If `miles` is not equal to `END_VAL` (0), the user is then asked, "How many gallons of gas did you use?"
  - **Calculation of mpg**: `mpg` is calculated as `miles / gallons`.
  - **Output mpg**: The calculated miles per gallon is displayed.
- **End Condition**: If `miles` is 0, the program outputs "End of program" and stops.

### Development Environment Details

- Integrated Development Environment (IDE): Visual Studio
- Solution Explorer is open, showing the project structure.
- The active file in the editor is "Week 12 Programming Exercise.c" within the "Week 12 Programming Exercise" solution. 

This exercise is suitable for understanding basic input/output operations in C and introduces simple conditionals for controlling program flow.
Transcribed Image Text:The image contains a screenshot of a C programming exercise from a development environment. Below is the transcription and explanation: --- **Week 12 Programming Exercise** ### Program Overview This program calculates the miles per gallon (mpg) based on user input for miles driven and gallons of gas used. It continues to prompt for these values until a user enters 0 for miles to end the program. ### Code ```c start Declarations num miles num gallons num mpg num END_VAL = 0 output "How many miles did you drive? Enter 0 to quit." input miles // This program continuously prompts a user for miles driven until 0 is entered. // While miles are not 0, gallons are entered, and mpg is calculated. if (miles not END_VAL) { output "How many gallons of gas did you use?" input gallons mpg = miles / gallons output "Your mpg is" + mpg } else { output "End of program" } stop ``` ### Explanation - **Declarations**: Variables `miles`, `gallons`, `mpg`, and `END_VAL` are declared. `END_VAL` is initialized to 0. - **Input Prompt**: The user is asked, "How many miles did you drive? Enter 0 to quit." - **Loop Condition**: If `miles` is not equal to `END_VAL` (0), the user is then asked, "How many gallons of gas did you use?" - **Calculation of mpg**: `mpg` is calculated as `miles / gallons`. - **Output mpg**: The calculated miles per gallon is displayed. - **End Condition**: If `miles` is 0, the program outputs "End of program" and stops. ### Development Environment Details - Integrated Development Environment (IDE): Visual Studio - Solution Explorer is open, showing the project structure. - The active file in the editor is "Week 12 Programming Exercise.c" within the "Week 12 Programming Exercise" solution. This exercise is suitable for understanding basic input/output operations in C and introduces simple conditionals for controlling program flow.
Expert Solution
steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
SQL Functions
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education