New Semester
Started
Get
50% OFF
Study Help!
--h --m --s
Claim Now
Question Answers
Textbooks
Find textbooks, questions and answers
Oops, something went wrong!
Change your search query and then try again
S
Books
FREE
Study Help
Expert Questions
Accounting
General Management
Mathematics
Finance
Organizational Behaviour
Law
Physics
Operating System
Management Leadership
Sociology
Programming
Marketing
Database
Computer Network
Economics
Textbooks Solutions
Accounting
Managerial Accounting
Management Leadership
Cost Accounting
Statistics
Business Law
Corporate Finance
Finance
Economics
Auditing
Tutors
Online Tutors
Find a Tutor
Hire a Tutor
Become a Tutor
AI Tutor
AI Study Planner
NEW
Sell Books
Search
Search
Sign In
Register
study help
computer science
microsoft visual c# introduction
Microsoft Visual C# An Introduction to Object-Oriented Programming 7th edition Joyce Farrell - Solutions
A local department store wants a program that displays the number of reward points a customer earns each month. The reward points are based on the customer’s membership type and total monthly purchase amount, as shown in Figure 9-41. The program should use a separate function for each membership
In this exercise, you will modify the savings account program shown earlier in Figure 9-18. Follow the instructions for starting C++ and viewing the Intermediate20.cpp file, which is contained in either the Cpp8\Chap09\Intermediate20 Project folder or the Cpp8\Chap09 folder. (Depending on your C++
In this exercise, you will create a program that displays a measurement in either inches or centimeters. If necessary, create a new project named Introductory18 Project, and save it in the Cpp8\Chap09 folder. The program should allow the user the choice of converting a measurement from inches to
In this exercise, you will create a program that displays the gross pay for one or more employees. If necessary, create a new project named Introductory17 Project, and save it in the Cpp8\Chap09 folder. The program should allow the user to enter the number of hours the employee worked and his or
In this exercise, you will create a program that displays a table consisting of four rows and three columns. The first column should contain the numbers 10 through 13. The second and third columns should contain the results of squaring and cubing, respectively, the numbers 10 through 13. The table
A program’s main function declares three double variables named salesTax, sales, and taxRate. It also declares a char variable named status. The main function contains the following statement: salesTax = getSalesTax(sales, status, taxRate);. The getSalesTax function header is shown here. Correct
Write a C++ statement that calculates the result of the following expression: (x / y)4 – 10. The x and y variables have the double data type. Assign the result to a double variable named answer.
Write a C++ statement that calculates the square root of the following expression: x2 * y3. The x and y variables have the double data type. Assign the result to a double variable named answer.
Write a C++ statement that adds the cube of the number stored in the num1 variable to the square root of the number stored in the num2 variable. The statement should assign the result to the answer variable. All of the variables have the double data type.
Write the C++ code for a function that prompts the user to enter a character and then stores the character in a char variable named response. The function should return the contents of the response variable. Name the function getCharacter. (The function will not have any actual arguments passed to
Write a C++ statement that assigns the square root of a number to a double variable named sqRoot. The number is stored in a double variable named num.
Write a C++ statement that displays a random integer from 50 through 100 on the computer screen.
Write an assignment statement that raises the number 3 to the 16th power and then assigns the result to a double variable named answer.
The variables in a function header have local scope. a. True b. False
A program contains three functions named main, calcGross, and displayGross. Two of the functions—main and calcGross—declare a variable named pay. The pay variable name also appears in the displayGross function header. When the computer processes the statement pay = hours * rate; in the
A variable’s _____________________ indicates where in the program a variable can be used. a. Lifetime b. Range c. Scope d. Span
Unless specified otherwise, variables in C++ are passed _____________________ . a. By address b. By content c. By reference d. By value
Which of the following directs a function to return the contents of the stateTax variable to the statement that invoked it, which is contained in the main function? a. restore stateTax; b. return stateTax c. return to main(stateTax); d. None of the above
Which of the following is a valid function header for the getFee function, which receives an integer first and a number with a decimal place second? The function returns a number with a decimal place. a. getFee(int base, double rate); b. double getFee(int base, double rate); c.
A program contains the statement tax = calcTax(sales);. The tax and sales variables have the double data type. Which of the following is a valid function header for the calcTax function? a. calcTax(double sales); b. double calcTax(salesAmount) c. double calcTax(double salesAmount)d.
Each memory location listed in a function header’s parameterList is referred to as _____________________ . a. An actual argument b. An actual parameter c. A formal argument d. A formal parameter
Which of the following is false? a. The number of actual arguments should agree with the number of formal parameters. b. The data type of each actual argument should match the data type of its corresponding formal parameter. c. The name of each actual argument should be identical to
The function header specifies _____________________ . a. The data type of the function’s return value (if any) b. The name of the function c. The function’s formal parameters (if any) d. All of the above
Value-returning functions can return _____________________ . a. One value only b. One or more values c. The number 0 only d. None of the above
Follow the instructions for starting C++ and viewing the SwatTheBugs22.cpp file, which is contained in either the Cpp8\Chap08\SwatTheBugs22 Project folder or the Cpp8\Chap08 folder. (Depending on your C++ development tool, you may need to open the project/solution file first.) Read the program’s
Create a program that displays movie ratings in a bar chart, similar to the one shown in Figure 8-28. If necessary, create a new project named Advanced21 Project, and save it in the Cpp8\Chap08 folder. Enter your C++ instructions into a source file named Advanced21.cpp. Also enter appropriate
Follow the instructions for starting C++ and viewing the Advanced20.cpp file, which is contained in either the Cpp8\Chap08\Advanced20 Project folder or the Cpp8\Chap08 folder. (Depending on your C++ development tool, you may need to open the project/ solution file first.) a. Run the program, which
In this exercise, you will modify the program from Lab 7-1 in Chapter 7. Follow the instructions for starting C++ and viewing the Intermediate17.cpp file, which is contained in either the Cpp8\Chap08\Intermediate17 Project folder or the Cpp8\Chap08 folder. (Depending on your C++ development tool,
Create a program that displays a table consisting of ten rows and four columns. The first column should display prices from $5 to $50 in increments of $5. The second and subsequent columns should display the discounted prices, using discount rates of 10%, 15%, and 20%, respectively. If necessary,
Create a program that displays a table consisting of four rows and five columns. The first column should display the numbers 1 through 4. The second and subsequent columns should display the result of multiplying the number in the first column by the numbers 2 through 5. If necessary, create a new
The code in Figure 8-24 should display the pattern of ampersands shown in the figure, but it is not working correctly. Debug the code. for (int row = 1; row < 4; row + 1) { for (int col = 1; col
Write the C++ code to display the integers 15, 12, 9, 6, 3, and 0 on separate lines on the computer screen. Use the for statement and an int variable named num.
A program declares an int variable named evenNum and initializes it to 2. Write the C++ code to display the even integers 2, 4, 6, 8, and 10 on separate lines on the computer screen. Use the do while statement.
Write a C++ while clause that processes a posttest loop’s instructions as long as the value in the inStock variable is greater than the value in the reorder variable.
Chakura is sitting at a table in a bookstore, attending her book signing. Customers are standing in line waiting for her to sign their copy of her book. However, it is possible that some customers in line may not have a book; they are in line simply to meet her. It’s also possible that some
What number will the following code display on the computer screen? int sum = 0; int y = 0; do { for (int x = 1; x <= 5; x += 1) sum += x; //end for y += 1; } while (y < 2); cout << sum << endl; a. 5 b. 8 c.
What pattern of asterisks will the following code display on the computer screen? for (int x = 1; x < 3; x += 1) { for (int y = 1; y < 4; y += 1) cout << “*”; //end for cout << endl; } //end for a. *** *** b.
What numbers will the following code display on the computer screen? int total = 1; do { total += 2; cout << total << endl; } while (total <= 3); a. 1, 2 b. 1, 3 c. 3 d. 3, 5
What value of x causes the loop in Review Question 5 to end? int x = 16; do { cout << x << endl; x -= 4; } while (x > 10); a. 0 b. 8 c. 10d. 12
Which of the following statements can be used to code a loop whose instructions you want processed 10 times? a. For b. Repeat c. While d. Either a or c
Which of the following updates the total accumulator variable by the value in the sales variable? a. total = total + sales; b. total = sales + total; c. total += sales; d. All of the above
What value stops the loop in Review Question 12? for (int numTimes = 4; numTimes <= 10; numTimes += 1) cout << numTimes << endl; //end for a. 4 b. 9 c. 10 d. 11
How many times will the computer process the cout statement in the following code? for (int numTimes = 4; numTimes <= 10; numTimes += 1) cout << numTimes << endl; //end for a. 0 b. 7 c. 10 d. 11
What numbers will the following code display on the computer screen? int x = 0; do { cout << x << endl; x += 1; } while (x < 5); a. 0, 1, 2, 3, 4 b. 0, 1, 2, 3, 4, 5 c. 1, 2, 3, 4 d. 1, 2, 3, 4, 5
It is possible that the instructions in the body of the _____________________ statement will not be processed during runtime. a. do while b. for c. while d. Both b and c
The instructions in the body of the _____________________ statement are always processed at least once during runtime. a. do while b. for c. while d. Both a and b
The condition in the do while statement is evaluated _____________________ the instructions in the loop body are processed. a. After b. Before
Follow the instructions for starting C++ and viewing the SwatTheBugs30.cpp file, which is contained in either the Cpp8\Chap07\SwatTheBugs30 Project folder or the Cpp8\Chap07 folder. (You may need to open the project/solution file first.) The program should display each salesperson’s bonus, which
Follow the instructions for starting C++ and viewing the SwatTheBugs29.cpp file, which is contained in either the Cpp8\Chap07\SwatTheBugs29 Project folder or the Cpp8\ Chap07 folder. (You may need to open the project/solution file first.) The program should display the numbers 1, 2, 3, and 4, but
Follow the instructions for starting C++ and viewing the SwatTheBugs28.cpp file, which is contained in either the Cpp8\Chap07\SwatTheBugs28 Project folder or the Cpp8\Chap07 folder. (You may need to open the project/solution file first.) The program should display the number of positive integers
Create a program that allows the user to enter the gender (either F or M) and GPA (0.0 through 4.0) for any number of students. The program should calculate and display the average GPA for all students, the average GPA for male students, and the average GPA for female students. If necessary, create
Baxter Skating Rink holds a weekly ice-skating competition. Competing skaters must perform a two-minute program in front of a panel of judges. The number of judges varies from week to week. At the end of a skater’s program, each judge assigns a score of 0 through 10 to the skater. Create a
A thrift store discounts the price of its items using rates of 10% through 40% in increments of 5%. Create a program that allows the store clerk to enter an item’s original price. The program should display the seven discount amounts and discounted prices. If necessary, create a new project named
Create a program that displays a multiplication table similar to the one shown in Figure 7-51. If necessary, create a new project named Introductory20 Project, and save it in the Cpp8\Chap07 folder. Enter your C++ instructions into a source file named Introductory20.cpp. Also enter appropriate
Create a program that displays the weekly gross pay for any number of employees. The user will input the number of hours the employee worked and the employee’s hourly rate. Employees working more than 40 hours receive time and one-half for the hours worked over 40. If necessary, create a new
Modify the solution shown earlier in Figure 7-2. The solution should now keep track of the number of times Sahirah’s laser beam missed the spider. After saying “You are safe now. The spider is dead.”, Sahirah should say one of the following: “I got him immediately.”, “I missed him one
Write an assignment statement that subtracts the contents of the salesReturns variable from the sales accumulator variable.
Write an assignment statement that updates a counter variable named quantity by –5.
Write a C++ while clause that stops the loop when the value in the inStock variable is less than or equal to the value in the reorder variable.
Write a C++ for clause that processes the loop instructions 10 times. Use numTimes as the counter variable’s name.
Write a C++ while clause that processes the loop instructions as long as the value in the age variable is greater than the number 18.
Write an assignment statement that updates an accumulator variable named totalPay by the value in the grossPay variable.
What value stops the loop in Review Question 10? for (int numTimes = 1; numTimes < 10; numTimes += 2) cout << numTimes << endl; //end for a. 6 b. 9 c. 10 d. 11
Use the code shown in Figure 6-34 to answer What will the code in Figure 6-34 display when the id variable contains the number 9? a. Janet b. Jerry c. Mark d. Sue switch (id) { case 8: cout
Use the code shown in Figure 6-34 to answer What will the code in Figure 6-34 display when the id variable contains the number 4? a. Janet b. Jerry c. Mark d. Sue switch (id) { case 8: cout
How many times will the computer process the cout statement in the following code? for (int numTimes = 1; numTimes < 10; numTimes += 2) cout << numTimes << endl; //end for a. 0 b. 5 c. 6 d. 9
A program allows the user to enter one or more numbers. The first input instruction will get the first number only and is referred to as the _____________________ read. a. Eentering b. Initializer c. Initializing d. Priming
Values that are used to end loops are referred to as _____________________ values. a. Closing b. Ending c. Sentinel d. Stop
Which of the following is a good sentinel value for a program that allows the user to enter a person’s age? a. –4 b. 350 c. 999 d. All of the above
Which of the following indicates that the loop should stop when the value in the quantity variable is less than the number 50? a. while (quantity >= 50) b. while (quantity < 50) c. while (quantity !> 50) d. while (quantity <= 50)
If necessary, create a new project named Advanced19 Project, and save it in the Cpp8\Chap06 folder. Enter (or copy) the instructions from the Lab6-2.cpp file into a new source file named Advanced19.cpp. Be sure to change the filename in the first comment. The program should now begin by determining
In this exercise, you will create a program that displays the number of daily calories needed to maintain your current weight. The number of calories is based on your gender, activity level, and weight. The formulas for calculating the daily calories are shown in Figure 6-44. a. Create an IPO
The C++ code in Figure 6-39 should display one of the four messages listed in the figure. The appropriate message is based on the level entered by the user. Correct the errors in the code. Level 1 or 2 Message Bronze 3 Silver 4 or 5 Gold Other Invalid ID int level = 0; %3D cout « "Level (1
A program uses a char variable named department and two double variables named salary and raise. The department variable contains one of the following letters (entered in either uppercase or lowercase): A, B, C, or D. Employees in departments A and B are receiving a 2% raise. Employees in
Use the code shown in Figure 6-34 to answer What will the code in Figure 6-34 display when the id variable contains the number 2? a. Janet b. Jerry c. Mark d. Sue switch (id) { case 8: cout
Use the code shown in Figure 6-33 to answerWhat will the code in Figure 6-33 display when the id variable contains the character 2? a. Janet b. Jerry c. Mark d. Sue if (id -- '8') cout
Write the C++ code for a multiple-alternative selection structure that displays one of four different messages, depending on the number of seminar participants stored in an int variable named participants. Display the message “Use the Kanton room” when the number of seminar participants is at
Travis is standing in front of two containers: one marked Trash and the other marked Recycle. In his right hand, he is holding a bag that contains either trash or recyclables. Travis needs to lift the lid from the appropriate container (if necessary), then drop the bag in the container, and then
A program stores test scores in two int variables named myScore and expectedScore. Write the C++ code to compare the two scores and then display one of the following messages: “I met my expectations”, “I scored higher than expected”, or “I scored lower than expected”
Use the code shown in Figure 6-33 to answerWhat will the code in Figure 6-33 display when the id variable contains the character 7? a. Janet b. Jerry c. Mark d. Sue if (id -- '8') cout
Use the code shown in Figure 6-33 to answerWhat will the code in Figure 6-33 display when the id variable contains the character 9? a. Janet b. Jerry c. Mark d. Sue if (id -- '8') cout
Use the code shown in Figure 6-33 to answerWhat will the code in Figure 6-33 display when the id variable contains the character 9? a. Janet b. Jerry c. Mark d. Sue if (id -- '8') cout
Use the code shown in Figure 6-32 to answer > number; cout" style="" class="fr-fic fr-dib">If the user enters the number 200, what value will be in the number variable after the selection structure in Figure 6-32 is processed? a. 0b. 100 c. 400 d. 600 int number - 0; "; cin >>
Use the code shown in Figure 6-32 to answer > number; cout" style="" class="fr-fic fr-dib">If the user enters the number 1000, what value will be in the number variable after the selection structure in Figure 6-32 is processed? a. 0 b. 100 c. 2000 d. 3000 int number - 0; ";
Use the code shown in Figure 6-32 to answer > number; cout" style="" class="fr-fic fr-dib">If the user enters the number 90, what value will be in the number variable after the selection structure in Figure 6-32 is processed? a. 0 b. 100 c. 180 d. 270 int number - 0; "; cin
Start your C++ development tool, and view the SwatTheBugs17.cpp file. The file is contained in either the Cpp8\Chap05\SwatTheBugs17 Project folder or the Cpp8\Chap05 folder. (Depending on your C++ development tool, you may need to open this exercise’s solution/project file first.) The program
As you learned in the chapter, you must be careful when comparing two real numbers for either equality or inequality because some real numbers cannot be stored precisely in memory. To determine whether two real numbers are either equal or unequal, you should test that the difference between both
Figure 5-35 shows the Mifflin–St Jeor formulas for calculating a person’s basal metabolic rate (BMR), which is the minimum number of calories needed to keep his or her body functioning while resting for 24 hours. A personal trainer at a local health club wants a program that displays a
Allenton Water Department wants a program that calculates a customer’s monthly water bill. The clerk will enter the current and previous meter readings. The program should calculate and display the number of gallons of water used and the total charge for the water. The charge for water is $7 per
A local department store is having a BoGoHo (Buy One, Get One Half Off) sale. The store manager wants a program that allows the salesclerk to enter the prices of two items. The program should calculate and display the total amount the customer owes. The half-off should always be taken on the item
Mountain Coffee wants a program that allows a clerk to enter the number of pounds of coffee ordered, the price per pound, and whether the customer should be charged a 3.5% sales tax. The program should calculate and display the total amount the customer owes. Use an int variable for the number of
Correct the errors in the lines of code shown in Figure 5-32. The code variable has the char data type; the other variables have the int data type. if (toupper(code) = 'x') cout > quantity; total = quantity 10; //end if Figure 5-32
A program uses a char variable named department and two double variables named salary and raise. The department variable contains one of the following letters (entered in either uppercase or lowercase): A, B, or C. Employees in departments A and B are receiving a 2% raise. Employees in department C
A program stores sales amounts in two double variables named marySales and jimSales. Write the C++ code to assign the highest and lowest sales amounts to the highSales and lowSales variables, respectively, and then display the contents of those variables. (You can assume that both sales amounts are
Which of the following tells the computer to display real numbers in fixed-point notation with no decimal places? a. cout << fixed << decimal(0); b. cout << fixed << precision(0); c. cout << fixed << setprecision(0); d. cout << fixed
Which of the following is required in a program that uses the setprecision stream manipulator? a. #include b. #include c. #include d. #include
Which of the following compares the contents of an int variable named quantity with the number 5? a. if (quantity = 5) b. if (quantity == 5) c. if (quantity is 5) d. if (quantity =! 5)
The expression 4 * 3 < 6 + 7 && 7 < 6 + 9 evaluates to _____________________ . a. True b. False
If an expression does not contain any parentheses, which of the following operators is performed first in the expression? a. Arithmetic b. Comparison c. Logical d. You can’t tell without seeing the expression
The computer will perform short-circuit evaluation when processing which of the following if clauses? a. if (3 * 2 < 4 && 5 > 3) b. if (6 < 9 || 5 > 3) c. if (12 > 4 * 4 && 6 > 2) d. All of the above
Showing 200 - 300
of 378
1
2
3
4
Step by Step Answers