Concept explainers
Assume w = 5, x = 4, y = 8, and z = 2. What value will be stored in result in each of the following statements?
A) result = x + y;
B) result = z * 2;
C) result = y / x;
D) result = y − z;
E) result = w % 2;
Learn your wayIncludes step-by-step video
Chapter 2 Solutions
Starting Out with C++: From Control Structures through Objects, Brief Version plus MyLab Programming with Pearson eText - Access Card Package (8th Edition)
Additional Engineering Textbook Solutions
Starting Out With Visual Basic (7th Edition)
Problem Solving with C++ (9th Edition)
Starting Out with Java: From Control Structures through Objects (7th Edition) (What's New in Computer Science)
Starting Out with Programming Logic and Design (4th Edition)
Introduction to Java Programming and Data Structures, Comprehensive Version (11th Edition)
Computer Science: An Overview (13th Edition) (What's New in Computer Science)
- 1- You are required to draw flow chart and write a Pseudocode for the following problem statement. Muscat MobiCare is a Mobile Outlet, which provides Mobile repair services. The charges of mobile repairs are based on the type of the service. Details of charges are as follow: Software Fault: 4 OMR Screen Fault: 6 OMR Network/Wi-Fi Fault: 8 OMR Internal Hardware Fault: 10 OMR The Outlet offers discount to the loyal customers. The discount is offered based on the customer visits to the outlet. Following is the detail of discounts. 1- Customer visiting 4 times a year gets 20% discount. 2- Customer visiting 6 times a year gets 30% discount. 3- Customer visiting 8 times a year gets 50% discount. You are required to draw a Flow Chart diagram and write a Pseudocode for a computer program that takes customer name, mobile model, visit date, total number of visits, and required service (mentioned above). The program outputs a receipt with all the entered information plus repair charges based on…arrow_forwardAssume x = 4, y = 7, and z = 2. What value will be stored in integer variable result by each of the following statements? A) result = x + y;B) result = y * 2;C) result = y / z;arrow_forwardAssume result is an int variable. When the following statement executes, what value will be stored in result? result = (2 + 5) * 10;arrow_forward
- A program contains the following function. int cube(int num) {return num * num * num; }Write a statement that passes the value 4 to this function and assigns its return value to the variable result.arrow_forwardIf the variable letter has been defined as a char variable, which of the following are not valid assignment statements? A) letter = w;B) letter = 'w';C) letter = "w";arrow_forwardIndicate if each of the following assignment statements is valid or invalid.A) total = 9;B) 72 = amount ;C) yourAge = myAge;arrow_forward
- Question: 27 Assume the following: int a = 5, b = 3; float x = 9.0, y = 2.11 z = 3.0; Evaluate the following expression: (int)(y * 10 + b)arrow_forwardAssume that qty and salesReps are both integers. Use a type cast expression to rewrite the following statement so it will no longer perform integer division.unitsEach = qty / salesReps;arrow_forwardBriefly explain passing by valuearrow_forward
- The Problem__: Write a program that calculates the average of a group of test scores, where the lowest score in the group is dropped. It should use the following functions: ⚫ void getScore() should ask the user for a test score, store it in a reference param- eter variable, and validate it. This function should be called by main once for each of the five scores to be entered. ⚫ void calcAverage() should calculate and display the average of the four highest scores. This function should be called just once by main and should be passed the five scores. ⚫int findLowest() should find and return the lowest of the five scores passed to it. It should be called by calcAverage, which uses the function to determine which of the five scores to drop. Input Validation: Do not accept test scores lower than 0 or higher than 100. YOU MUST USE THE STATED FUNCTIONS AND COMPLETE Input VALIDATION. **DO NOT use an ARRAY OR GLOBAL VARIABLES!!. you MUST USE function prototyping TEST THE FUNCTION TWICE.…arrow_forwardQuestion: Party budget planning Prompt the user to enter their current budget and the number of people who need to share a meal. You are ordering food from a restaurant that has two menu items: Tacos $4 Empanadas $3 Calculate and print out all the options of meals where the budget is used entirely(where possible) and each person has an equal number of items to eat. They may eat different things, but everyone gets the same number of food items, e.g. 2 tacos or 1 empanada and 1 taco or 2 empanadas. Hints: Here are some things that might help you in your solution. If total items purchased does not equally divide by the number of diners, then abandon that combination. It may help to calculate the max number of empanadas that the budget can buy and also the max number of tacos that the budget could buy. These can be thought of as upper bounds in your loops. In your solution, keep track of items per person Also, keep track of total number of viable solutions, as that might help you…arrow_forwardLook at the following code.double value = 29.7;double *ptr = &value;Write a cout statement that uses the ptr variable to display the contents of the valuevariable.arrow_forward
- C++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology PtrMicrosoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,