My code #include using namespace std; int main () {   float meal_cost,total_bill,tax_amount,tip_amount;   cout <<"Enter a meal charge:";      cin >> meal_cost;        tax_amount = 0.0675 * meal_cost;     tip_amount = 0.2 * (tax_amount + meal_cost);     total_bill = meal_cost + tax_amount + tip_amount;     cout <<"The meal cost is"<< meal_cost <> meal_cost;", and "tax_amount = 0.0675 * meal_cost;". These two lines should be equal tabbed with the rest within the main() brackets, though those might be a copy-paste error rather than an error in your code. However, this code should output the correct answer, and everything I've pointed out has been purely aesthetic issues. 2- Your code looks just fine I would just do some things different. It is easier if you make space between lines in your code especially between the variables and the rest. Your variables had clear names however it may be better to shorten them a bit like instead of total_bill you can put total or bill. You could also put tax_amt instead of tax_amount. I also believe it would be easier if you would add more comments to you code so you and others can understand it better.

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

My code

#include <iostream>
using namespace std;
int main ()
{
  float meal_cost,total_bill,tax_amount,tip_amount;
  cout <<"Enter a meal charge:";
     cin >> meal_cost;
       tax_amount = 0.0675 * meal_cost;
    tip_amount = 0.2 * (tax_amount + meal_cost);
    total_bill = meal_cost + tax_amount + tip_amount;
    cout <<"The meal cost is"<< meal_cost <<endl;
    cout <<"tax amount" << tax_amount <<endl;
    cout <<"tip amount" << tip_amount <<endl;
    cout <<"total bill" << total_bill <<endl;

    return 0;
}

Two Comment I got:

1- Although this one is one of the shortest ones I've seen, I think the readability of the code could be improved with a couple of blank lines here and there. I'm pretty sure the computer just skips them with no effect on run speed. Also, there are a couple of weirdly placed tabs for the lines "cin >> meal_cost;", and "tax_amount = 0.0675 * meal_cost;". These two lines should be equal tabbed with the rest within the main() brackets, though those might be a copy-paste error rather than an error in your code. However, this code should output the correct answer, and everything I've pointed out has been purely aesthetic issues.

2- Your code looks just fine I would just do some things different. It is easier if you make space between lines in your code especially between the variables and the rest. Your variables had clear names however it may be better to shorten them a bit like instead of total_bill you can put total or bill. You could also put tax_amt instead of tax_amount. I also believe it would be easier if you would add more comments to you code so you and others can understand it better.

For Question I attached the pricture 

1. Return to the M03 Peer Review assignment and reply to/comment on two of the peer reviews you received (within the discussion board):
   - Address any questions or misconceptions the reviewer may have posted.
   - Indicate how useful the feedback was.
   - Did you understand the comments/observations/suggestions?
   - Did the review point out flaws/shortcomings in your program?
   - Did you learn anything from the critique?

2. In the comment section of this assignment, inform the instructor of your thoughts on the review activity. What did you find most useful from the review activity (reviewing other students' programs and/or having your program reviewed)? Did the process help you better understand the original programming assignment? Would you modify your program based on the feedback/observations?
Transcribed Image Text:1. Return to the M03 Peer Review assignment and reply to/comment on two of the peer reviews you received (within the discussion board): - Address any questions or misconceptions the reviewer may have posted. - Indicate how useful the feedback was. - Did you understand the comments/observations/suggestions? - Did the review point out flaws/shortcomings in your program? - Did you learn anything from the critique? 2. In the comment section of this assignment, inform the instructor of your thoughts on the review activity. What did you find most useful from the review activity (reviewing other students' programs and/or having your program reviewed)? Did the process help you better understand the original programming assignment? Would you modify your program based on the feedback/observations?
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Variables
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.
Similar questions
  • SEE MORE QUESTIONS
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