Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The three following programs do not work due to C++ syntax errors. Students with a last name that begins with A-I will select Program #1,

The three following programs do not work due to C++ syntax errors. Students with a last name that begins with A-I will select Program #1, students with a last name that begins with J-Q will select Program #2, and students with last name that begins with R-Z will selection program #3. Your task is to find 2 errors with the syntax. For each of the 2 errors, copy and paste the line of code with the error and then explain what the error is. You cannot post about errors already found by your classmates. You should not discuss more than 2 errors so that your classmates have errors to find. Provide a resource that explains the syntax rules for each error. You could provide a page number from your eTextbook or a link to a resource that you found on the Internet. Referring to the Introduction section of Appendix A, how could using a coding style standard help programmers develop working programs? Program #1 //This program prompts the user for their name, the year they were born, //and the current year. The program calculates the user's age. //The program outputs the user's name and age #include //When using cin and cout, you need to include this header using namespace std; int Main() //every program has a main() { //Declare the variables string name; Int current_year; Int birth_year; String age; //Prompt the user to enter their name cout < "Hello! " < "Please enter your name " < endlines //get the input from the user and assign to variable name cin << Name; //Prompt the user to enter the year they were born out << "Hello! " "Please enter the year you were born " << endl //get the input from the user and assign to variable birth_year cin >> yearOfBirth; /* Prompt the user to enter the current year cOut << Hello! << Please enter the current year (example: 2016) << endl; //get the input from the user and assign to variable current_year cIn >> currentyear; //Calculate the user's age age = current_year + birth_year; //output name and age cout >> "Hello! " << Name << "Your age is " << Current_Year; //always end your main() with 'return 0'. This means it returns successfully return 0 Program #2 //This program prompts the user for the price of a book and the sales tax //the program calculates the sales tax for the book and outputs the total //price of the book with sales tax added. include //When using cin and cout, you need to include this header used namespacecadet std; integer main[]//every program has a main() { //Declare the variable name Double total_price; double price_of_book; double sales_tax; String tax //Prompt the user to enter the price of the book Cout << "Please enter the price of your book " << endl; //get the input from the user and assign to variable name Cin >> priceofbook; //Prompt the user to enter the sales tax cin << "Please enter the sales tax as a decimal " << endl; //get the input from the user and assign to variable name cout >> salestax //Calculate the tax tax = sales_tax / price_of_book; //Calculate the total price of the book totalprice = tax - price_of_book; //output name and age cout >> "Amount due " << price_of_book; //always end your main() with 'return 0'. This means it returns successfully return 10; } Program #3 //This program asks the user for first name and last name. The program //concatenates the first and last name to form the full name. The full name //is outputted. The program asks the user for their current salary. The //program calculates the new salary after a raise is applied. #include# < //When using cin and cout, you need to include this header using namespace standard; Int Main[] //every program has a main() ( //Declare the variable name string full_name; string first_name; String last_name; Double current_salary; double raise_increase double salary_increase; double new_salary; //Prompt the user to enter their first name cout << "Please enter your first name " << endl //get the input from the user and assign to variable first_name cin >> firstname; //Prompt the user to enter their last name cout << "Please enter your last name << endl; get the input from the user and assign to variable last_name cin >> last_name; //concatenate first_name and last_name to get full_name fullname == first_name * last_name; //Output full_name cout << "Your full name is " << full_name; //Prompt the user to enter their current salary printout << "Please enter your current salary " << endl; //get the input from the user and assign to variable name Cin >> current_salary; //Prompt the user to enter their percentage raise increase as a decimal cout << Please enter your percentage raise increase as a decimal " << endl //get the input from the user and assign to variable name cin >> raise //Calculate salary increase; salary_increase == raise_increase / current_salary; //Calculate new salary; New_Salary = Salary_Increase * Current_Salary; //output new salary cout < "After your raise your new salary is " < newSalary << endl; //always end your main() with 'return 0'. This means it returns successfully return; )

Please make copy paste available

Please write in C++

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

Database Management System MCQs Multiple Choice Questions And Answers

Authors: Arshad Iqbal

1st Edition

1073328554, 978-1073328550

More Books

Students also viewed these Databases questions