CIS 150 Lab 2: Selection – With C++ Code and Answers in word document – Perfect Solution – Instant Delivery

Lab Price = $9
Please feel free to send us your queries at: [email protected]
Payment methods

Add to Cart

Buy Now

View Cart


Problem Statement

CIS 150 Lab: Selection
Objectives
• Fix tests that check for values and ranges
• Create working C++ switch statements
• Create selection statements that detect different ranges of values
Lab requirements
Modify the supplied program (decisionsLab.cpp) to make it work properly.

/*
decisionsLab.cpp
Name:
CIS 150
Date:

CIS 150 Chapter 4 Decisions Lab
*/

/*
Place your name and section at the top in comments.
Read the instructions for each question and give your
answer in comments or write the code into the program.

You should uncomment sections as you get them working. Declare variables
if necessary. You do not need to get input from the user unless
otherwise specified or that code is already written.
*/

#include
#include
#include
using namespace std;

int main() {
cout << "Part 1\n"; for (int age=50; age<=80; age=age+15) { cout << "Testing with age = " << age << '\n'; float admission = 0.0; /* Part 1. Find and fix the error(s) in the following code. if (age > = 65);
cout <<"Age greater than or equal to 65\n"; admission = 10.0; else cout << "Age is less than 65\n"; admission = 15.0; cout << "Admission: " << fixed << showpoint << setprecision(2) << admission << '\n'; */ } cout << "\nPart 2\n"; for (int count=5; count<=15; count+=5) { cout << "Testing with count = " << count << '\n'; /* Part 2. Find and fix the error(s) in the following code. if (count = 10) cout << "The count is 10\n"; else cout << "The count is NOT 10\n"; */ } cout << "\nPart 3\n"; for (int score=-50; score<=150; score+=50) { cout << "Testing with score = " << score << '\n'; /* Part 3. Find and fix the error(s) in the following code. // checking to see of score is less than 0 or greater than 100 if (0 > score > 100) cout << "The score is out of range\n"; else cout << "The score is in range\n"; */ } cout << "\nPart 4\n"; cout << "1. Enter data and save to file\n" << "2. Read data in and display report\n" << "3. Quit the program\n"; for (int option=-1; option<=4; option++) { cout << "Testing with option = " << option << '\n'; /* Part 4. Write a switch statement that will display a simple message telling the user which option was chosen. For example, if the option chosen was 2, output "Read data". Display an invalid entry message if the option chosen is something other than 1, 2, or 3. For testing purposes the option will be chosen by a loop variable rather than getting actual user input. */ } cout << "\nPart 5\n"; for (double sales=0.0; sales<=25000.0; sales+=2500.0) { cout << "Testing with sales = $" << fixed << showpoint << setprecision(2) << sales << '\n'; double rate = 0.0; /* Part 5. Write a decision structure that will set the variable rate to the proper value based on the value of sales. Follow these rules: No commision is paid for sales of 0 or less. A sales commision of 2% (.02) is paid for sales over 0 up to 10,000. A sales commision of 3% (.03) is paid for sales over 10,000 up to 15,000. A sales commision of 4% (.04) is paid for sales over 15,000 up to 20,000. A sales commision of 5% (.05) is paid for sales over 20,000. // write your code to set the rate here cout << "The commission is $" << rate * sales << endl; */ } // cross platform pause if (cin.rdbuf()->sungetc() != -1 && cin.get() != ‘\n’) cin.ignore(80,’\n’);
cout << "Press enter to continue..."; cin.get(); return 0; } Example run of program Part 1 Testing with age = 50 Age is less than 65 Admission: 15.00 Testing with age = 65 Age greater than or equal to 65 Admission: 10.00 Testing with age = 80 Age greater than or equal to 65 Admission: 10.00 Part 2 Testing with count = 5 The count is NOT 10 Testing with count = 10 The count is 10 Testing with count = 15 The count is NOT 10 Part 3 Testing with score = -50 The score is out of range Testing with score = 0 The score is in range Testing with score = 50 The score is in range Testing with score = 100 The score is in range Testing with score = 150 The score is out of range Part 4 1. Enter data and save to file 2. Read data in and display report 3. Quit the program Testing with option = -1 Invalid choice Testing with option = 0 Invalid choice Testing with option = 1 Enter data Testing with option = 2 Read data Testing with option = 3 Quit Testing with option = 4 Invalid choice Part 5 Testing with sales = $0.00 The commission is $0.00 Testing with sales = $2500.00 The commission is $50.00 Testing with sales = $5000.00 The commission is $100.00 Testing with sales = $7500.00 The commission is $150.00 Testing with sales = $10000.00 The commission is $200.00 Testing with sales = $12500.00 The commission is $375.00 Testing with sales = $15000.00 The commission is $450.00 Testing with sales = $17500.00 The commission is $700.00 Testing with sales = $20000.00 The commission is $800.00 Testing with sales = $22500.00 The commission is $1125.00 Testing with sales = $25000.00 The commission is $1250.00 Press enter to continue... Rubric • 2 points: for getting part 1 working properly • 2 points: for getting part 2 working properly • 2 points: for getting part 3 working properly • 2 points: for getting part 4 working properly • 2 points: for getting part 5 working properly

Relevant Material
Screenshots

Lab 2: Screenshot
Lab 2: Screenshot
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 [email protected].
* 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 [email protected] 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 [email protected].
* 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 [email protected]
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 = $9
Please feel free to send us your queries at: [email protected]

Payment methods

Add to Cart

Buy Now

View Cart

Leave a Reply