C1S170 Lab 1 in C++ – All 3 programs with screenshots and word document – perfect Solution – Instant Delivery

Lab Price = $5
Please feel free to send us your queries at: support@iqrajavaid.com
Payment methods

Add to Cart

Buy Now

View Cart


Problem Statement

CIS170C Week 1 Lab Instructions

Lab 1 of 7: Getting Started (Your First C++ Programs)

Lab Overview—Scenario/Summary

Welcome to programming with C++. The purpose of this three-part lab is to walk you through the following tutorial to become familiar with the actions of compiling and executing a C++ program.

In general, this lab will instruct you on

1. how to create a project;
2. how to enter and save a program;
3. how to compile and run a program;
4. how to, given a simple problem using input and output, code and test a program that meets the specifications; and
5. how to debug a simple program of any syntax and logic errors.

Deliverables

Section Deliverable Points
Part A Step 6: Program Listing and Output 10
Part B Program Listing and Output 10
Part C Program Listing and Output 10
All Parts Total 30

Lab Steps

Preparation:

If you are using the Citrix remote lab, follow the login instructions located in the lab (under General Resources within Course Resources) in Course Home.

Part A: Getting Started
Step 1: Start the Application
1. From the File menu, choose New Project.
2. Choose Win32 Console Application.
3. Enter a name in the name field.
4. Click OK.
5. Click Next, and choose the following options.
6. Application Type: Console Application
7. Additional options: Check mark Empty project.
8. Click Finish. Your project is now created.
Step 2: How to Add a Source Code File to Your Project (.cpp file)
1. In the Solution Explorer, right-click on the Source Files folder and select Add and then New Item.
2. In the next dialog box, choose C++ file (.cpp), enter a name for your source code file, and press the Add button.
3. Type or copy and paste your code into the newly created source code file. Build the file by pressing F7, and then execute your program by pressing CTRL-F5 (start without debugging), or use the F5 key (Start Debugging).

Step 3: Create a Source Code File
Now enter the following C++ program exactly as you see it. Use the tab where appropriate. [Note: C++ is case sensitive.] Instead of John Doe, type your name.

// —————————————————————
// Programming Assignment: LAB1A
// Developer: ______________________
// Date Written: ______________________
// Purpose: Ticket Calculation Program
// —————————————————————
#include

using namespace std;

void main()
{

cout << "John Doe ticket program\n";

int childTkts, adultTkts, totalTkts;
cout << "Please enter the number of child tickets:";
cin >> childTkts;
cout << "Please enter the number of adult tickets:";
cin >> adultTkts;
totalTkts = childTkts + adultTkts;

cout << "The total tickets are: "<

}

When you execute a program in debug mode (F5), the console screen may appear and disappear
before you have an opportunity to view your output. There are several techniques you can use to
pause the console screen so you can read the output. On the very last line in the main() function,
a. insert the statement: system("pause");
-OR-
b. insert an input statement: cin >> myVarable;

Step 4: Output
The black screen or console should read

Step 5: Save Program
Save your program by clicking File on the menu bar and then clicking Save Program.cpp, or by clicking the Save button on the toolbar, or Ctrl + S.

Step 6: Build Solution
To compile the program, click Build on the menu bar, and then click the Build Solution or Build LabA option. You should receive no error messages. If you see some error messages, check the code above to make sure you didn’t key in something wrong. Once you make your corrections to the code, go ahead and click Build >> Build Solution again.
Step 7: Execute the Program
Once you have no syntax errors, to execute or run your program, click Debug on the menu bar, and then click Start Without Debugging.
Step 8: Capture the Output
Print a picture of your screen output. (Do a print screen, and paste this into MS Word.)
Step 9: Print the Source Code
Copy your source code and paste it into the same Word document as your screen print. Save the Word Document as Lab01_LastName_FirstInitial.
Note: Using the Visual Studio editor to compile your programs creates a lot of overhead. These additional files will become important as you create more sophisticated C# projects. Projects can contain one or more source-code files. For this course, you will not have to worry about all the extra files that are created.
End of Part A
Part B: Debugging a program
Step 1: Create New Project
Now create a new project and name it LAB1B. Make sure you close your previous program by clicking File >> Close Solution.
Step 2: Type in Program
Like before, enter the following program. Type in your name for Developer and current date for Date Written.

This program has three errors.

// —————————————————————
// Programming Assignment: LAB1B
// Developer: ______________________
// Date Written: ______________________
// Purpose: Average Program
// —————————————————————
#include

using namespace std;

void main()
{

cout << "Find the Average Program\n";

double num1, num2, num3, average;
cout << "Please enter number 1: ";
cin >> num1;
cout << "Please enter number 2: "
cin << num2;
cout << "Please enter number 3: ";
cin >> num3;
average = num1 + num2 + num3 / 3;

cout << "The average is: " << average << endl;
system("pause");

}
When you build the solution you will see the debugger. Double click on an error to locate the error. If it is a syntax error, the error will be listed in the error list. Some errors will be underlined in red. Once you fix the syntax errors, use the F11 (step into code) and F10 (step over code) commands to locate the logic error in the code.

Step 3: Save Program
Save your program by clicking File on the menu bar and then clicking Save Program.cpp, or by clicking the Save button on the toolbar, or Ctrl + S.

Step 4: Build Solution
To compile the program, click Build on the menu bar, and then click the Build Solution or Build LabB option. You should receive no error messages. If you see some error messages, check the code above to make sure you didn't key in something wrong. Once you make your corrections to the code, go ahead and click Build >> Build Solution again.

Step 5: Execute the Program
Once you have no syntax errors, to execute or run your program, click Debug on the menu bar, and then click Start Without Debugging.

Step 6: Capture the Output
1. Capture a screen print of your output. (Do a PRINT SCREEN and paste into the Word document from Part A.)
2. Copy your code and paste it into the same MS Word document that contains the screen print of your output.
3. List all three errors.
4. Save this in the same Word document as Part JA.
End of Part B

Part C: Payroll Program
Step 1: Create a New Project
Create a new project and name it LAB1C. Make sure you close your previous program by clicking File >> Close Solution.

Include a comment box like what you coded in Part B. This can go at the very top of your program.
Step 2: Processing Logic
You need to write a program that calculates and displays the revenue earned from ticket sales at a movie theater.

Input: Prompt the user for the number of adult tickets. Prompt the user for the number of child tickets.
Process: Perform the calculations. The adult tickets cost $10.00 and the child tickets cost $6.00. The theater keeps 20% of the gross box office profit, and the rest goes to the movie distributor.
Output: Display the results.
Sample Output from Lab 1:

Flowchart: (continued on next page)

Pseudo Code:

1. Declare variables
2. Accept Input – child tickets and adult tickets
3. Calculate Child ticket total = child tickets* 6
4. Calculate adult ticket total = adult tickets * 10
5. Calculate gross profit = child ticket total + adult ticket total
6. Calculate net profit = gross profit *0.2
7. Calculate distributor amount = gross profit – net profit
8. Display the following on separate lines and format variables with $ and decimal.
a. Gross Profit value of gross profit
b. Net Profit value of net profit
c. Distributor Amount value of distributor amount

//include the iomanip header file at the top of the file
#include

//use fixed and setprecision(2) to format the number
//use setw(8) to control the width of the field
//use \t to control the spacing between fields
cout << fixed << setprecision(2);
cout << "Gross Profit :\t $" << setw(8) << grossProfit << endl;

Step 3: Save Program
Save your program by clicking File on the menu bar and then clicking Save Program.cpp, or by clicking the Save button on the toolbar, or Ctrl + S.

Step 4: Build Solution
To compile the program, click Build on the menu bar and then click the Build Solution, or Build LabC option. You should receive no error messages. If you see some error messages, check the code above to make sure you didn't key in something wrong. Once you make your corrections to the code, go ahead and click Build >> Build Solution again.

Step 5: Execute the Program
Once you have no syntax errors, to execute or run your program, click Debug on the menu bar, and then click Start Without Debugging.

Step 6: Capture the Output

1. Capture a screen print of your output. (Do a PRINT SCREEN and paste into an MS Word document.)
2. Copy your code and paste it into the same MS Word document that contains the screen print of your output.
3. Use the same Word document as Part A and B.
End of Part C
END OF LAB

Relevant Material
Screenshots
Screenshot: Lab1A

Screenshot: Lab1A

Screenshot: Lab1B

Screenshot: Lab1B

Screenshot: Lab1C

Screenshot: Lab1C

Instructions
* If you want to purchase multiple products then click on “Buy Now” button which will give you ADD TO CART option.Please note that the payment is done through PayPal.
* You can also use 2CO option if you want to purchase through Credit Cards/Paypal but make sure you put the correct billing information otherwise you wont be able to receive any download link.
* Your paypal has to be pre-loaded in order to complete the purchase or otherwise please discuss it with us at support@iqrajavaid.com.
* As soon as the payment is received, download link of the solution will automatically be sent to the address used in selected payment method.
* Please check your junk mails as the download link email might go there and please be patient for the download link email. Sometimes, due to server congestion, you may receive download link with a delay.
* All the contents are compressed in one zip folder.
* In case if you get stuck at any point during the payment process, please immediately contact us at support@iqrajavaid.com and we will fix it with you.
* We try our best to reach back to you on immediate basis. However, please wait for atleast 8 hours for a response from our side. Afterall, we are humans.
* Comments/Feedbacks are truely welcomed and there might be some incentives for you for the next lab/quiz/assignment.
* In case of any query, please donot hesitate to contact us at support@iqrajavaid.com.
* MOST IMPORTANT Please use the tutorials as a guide and they need NOT to be used for any submission. Just take help from the material.
******************************************** Good Luck ***************************************************
Privacy Policy
We take your privacy seriously and will take all measures to protect your personal information.
Any personal information received will only be used to fill your order. We will not sell or redistribute your information to anyone.
Refund Policy
Incase you face any issues with the tutorial, please free to contact us on support@iqrajavaid.com
We will try our best to resolve the issue and if still persists we can discuss for a refund in case its required.
Payment Details
Lab Price = $5
Please feel free to send us your queries at: support@iqrajavaid.com
Payment methods

Add to Cart

Buy Now

View Cart