Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Specification – A brief description of what the program accomplishes including i

ID: 3619898 • Letter: S

Question

Specification – A brief description of what the program accomplishes including its input, key processes and output.
Test Plan – A brief description of the method you used to confirm your program worked properly. If necessary, include a clearly labeled table with test cases, predicted results and actual results.
Summary & Conclusions:

Summary: Write a statement summarizing your predicted and actual output; identify and explain any differences.

Conclusions: Write at least one non-trivial paragraph that explains in detail either a significant problem you had and how you solved it, or, if you had no significant problems, something you learned by doing the exercise.

Each lab exercise should have it's own section in the lab report document.

Grading
Your lab grade will be based upon:

The formatting of your source code
The use of meaningful identifiers
The extent of internal documentation
The degree to which an exercises’ specifications are meet and the completeness of your lab report.
L A B
Walkthrough: Using the Visual Studio Debugger (not graded but required)


Follow the instructions in the following Word document to learn how to use the Visual Studio debugger.

Debugger Walkthrough Instructions

Is this your first time using Visual Studio? If so, download this example project and follow these directions to get up and running fast!

Exercise 1: Recognizing Proper Syntax and Formatting (20 points)


Objective: Use your knowledge of C++ to identify and correct the syntax and formatting errors in the following C++ code:


/******************************************************************
* Programmer: [put your name here]
*
* Date: [put the current date here]
*
* Course: COMP 220
*
* Assignment: Correcting syntax errors and program formatting
*
* Description: this program display a menu and allows the
* user to select an item from the menu
*
* Assumptions: Assumes that the user enters a valid number corresponding
* to a menu item
*
* Input: keyboard - enter an integer.
*
* Output: screen - display the users menu selection
*
********************************************************************/

#include <io>

main ( )
}
int usersChoice = menu();
cout << " You Choose " << userdChoice;

return 0;
} //end main

int menu(void){
//displays a menu and returns
//the integer value of the item
//selected by the user

cout >> "Choose From Martha's Menu:/n"
cout << "1 - Dinner"
cout << endln << 2 - Lunch";
cout << endln << "3 - Breakfeast";
cout << "Enter a number:"
int choice = 0;
cin << Choice

return choice;

} //end menu

Steps:

Create a new Visual Studio project and source code file.
Copy and paste the code above into the source code file.
Correct the syntax errors and properly format the code.
Submit your corrected source code.
Exercise 2: Identifying and Correcting Logical Errors (20 points)


Objective: Use the Visual Studio debugger to identify and correct the logical errors contained in the following program:

/******************************************************************
* Programmer: [put your name here]
*
* Date: [put the current date here]
*
* Course: COMP 220
*
* Assignment: Identification and correction of logical errors
*
* Description: this program prints a triangle with a base of five asterisks
*
* Output: screen - displays a triangle
*
********************************************************************/

#include <iostream>

int drawBar(int);

int main()
{
std::cout << std::endl << "Let's Draw a triangle! ";

//determine how many lines will be drawn
int triangleBase = 0;

//draw the triangle
for (int i = 0 ; i >= triangleBase ; i--) {
drawBar(i);
}

return 0;
} //end main

int drawBar(int barSize) {
//draws a line of asterisks
//the number of asterisk drawn equals barSize

int theCounter = 0;
while (theCounter >= barSize) {
theCounter--;
std::cout << '*';
}
std::cout << ' ';
return 0;
} //end drawBar
Steps:

Create a new Visual Studio project and source code file.
Copy and paste the code above into the source code file.
Correct the Logical errors in the code so that the output of the program appears as such:
*
**
***
****
*****

Submit your corrected source code.

Explanation / Answer

#include <iostream> // no file directory in C++ names io
using namespace std; // for input output functins like cout, cin, cerr. etc. etc
int menu(void);
main ( ) { // it must be left bracket int usersChoice = menu(); // menu was undelcared, I have declared it cout << " You Choose " << usersChoice; // spelling mistake, here it must be usersChoice
return 0; system("pause"); } //end main
int menu(void){ //displays a menu and returns //the integer value of the item //selected by the user
cout << "Choose From Martha's Menu:/n"; // here cout must have << instead of >>    // semicolong was also missing cout << "1 - Dinner"; // semicolong was missing cout << endl << "2 - Lunch"; // must be endl instead of endln, also missing starting    // double quote cout << endl << "3 - Breakfeast"; // must be endl insread of endln cout << "Enter a number:"; // semicolon was missing int choice = 0; cin >> choice; // cin must have >> instead of << and no semicolong at the end was present
/*
either int choice = 0 must be changed to int Choice = 0 or cin>> Choice; must be changed to cin>> choice; */ return choice;
} //end menu =================================================================== #include <iostream> // no file directory in C++ names io
using namespace std; // for input output functins like cout, cin, cerr. etc. etc
int menu(void);
main ( ) { // it must be left bracket int usersChoice = menu(); // menu was undelcared, I have declared it cout << " You Choose " << usersChoice; // spelling mistake, here it must be usersChoice
return 0; system("pause"); } //end main
int menu(void){ //displays a menu and returns //the integer value of the item //selected by the user
cout << "Choose From Martha's Menu:/n"; // here cout must have << instead of >>    // semicolong was also missing cout << "1 - Dinner"; // semicolong was missing cout << endl << "2 - Lunch"; // must be endl instead of endln, also missing starting    // double quote cout << endl << "3 - Breakfeast"; // must be endl insread of endln cout << "Enter a number:"; // semicolon was missing int choice = 0; cin >> choice; // cin must have >> instead of << and no semicolong at the end was present
/*
either int choice = 0 must be changed to int Choice = 0 or cin>> Choice; must be changed to cin>> choice; */ return choice;
} //end menu =================================================================== #include <iostream>
void drawBar(int);
int main() { std::cout << std::endl << "Let's Draw a triangle! ";
//determine how many lines will be drawn int triangleBase = 5;
//draw the triangle for (int i = 0 ; i <= triangleBase ; i++) { drawBar(i); }
return 0; } //end main
void drawBar(int barSize) { //draws a line of asterisks //the number of asterisk drawn equals barSize
int theCounter = 0; while (theCounter <= barSize) { theCounter++; std::cout << '*'; } std::cout << ' '; } //end drawBar
#include <iostream>
void drawBar(int);
int main() { std::cout << std::endl << "Let's Draw a triangle! ";
//determine how many lines will be drawn int triangleBase = 5;
//draw the triangle for (int i = 0 ; i <= triangleBase ; i++) { drawBar(i); }
return 0; } //end main
void drawBar(int barSize) { //draws a line of asterisks //the number of asterisk drawn equals barSize
int theCounter = 0; while (theCounter <= barSize) { theCounter++; std::cout << '*'; } std::cout << ' '; } //end drawBar #include <iostream>
void drawBar(int);
int main() { std::cout << std::endl << "Let's Draw a triangle! ";
//determine how many lines will be drawn int triangleBase = 5;
//draw the triangle for (int i = 0 ; i <= triangleBase ; i++) { drawBar(i); }
return 0; } //end main
void drawBar(int barSize) { //draws a line of asterisks //the number of asterisk drawn equals barSize
int theCounter = 0; while (theCounter <= barSize) { theCounter++; std::cout << '*'; } std::cout << ' '; } //end drawBar
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote