Starting Out with Programming Logic and Design (4th Edition)
4th Edition
ISBN: 9780133985078
Author: Tony Gaddis
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Concept explainers
Textbook Question
Chapter 2, Problem 4AW
Assume the variables result, x, y, and z are all integers, and that x = 4, y = 8, and z = 2. What value will be stored in result in each of the following statements?
- a. Set result = x + y
- b. Set result = z * 2
- c. Set result = y / x
- d. Set result = y – z
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
x = 9 ;
y = x++
What are the values of x and y after the two statements execute?
X =
y =
The company discounted used cars pays their employees according to this chart: 250$ per months plus 50$ per car sold. If the salesman sells more than 10 cars, the employee receives a bonus of 5% of the total of his sales, in addition to his regular salary.Each month, the owner sits in front of the computer, and enters the following information: The name of the employee, the number of cars sold, as well as the total of all the sales for the month.
algorithm that will calculate the salary of an employee for the month, and then display on the screen, his name, total cars sold, base salary, bonus if applicable and entire salary
Write MARIE assembly language code to implement the following algorithm:
Chapter 2 Solutions
Starting Out with Programming Logic and Design (4th Edition)
Ch. 2.1 - Who is a programmers customer?Ch. 2.1 - What is a software requirement?Ch. 2.1 - What is an algorithm?Ch. 2.1 - What is pseudocode?Ch. 2.1 - Prob. 2.5CPCh. 2.1 - Prob. 2.6CPCh. 2.2 - Prob. 2.7CPCh. 2.2 - Prob. 2.8CPCh. 2.2 - What is a sequence structure?Ch. 2.2 - Prob. 2.10CP
Ch. 2.2 - Prob. 2.11CPCh. 2.2 - Prob. 2.12CPCh. 2.2 - Summarize three common rules for naming variables.Ch. 2.2 - Prob. 2.14CPCh. 2.2 - Look at the following pseudocode statement: Input...Ch. 2.2 - Prob. 2.16CPCh. 2.2 - Prob. 2.17CPCh. 2.2 - What two steps usually take place when a program...Ch. 2.2 - What does the term user-friendly mean?Ch. 2.3 - Prob. 2.20CPCh. 2.3 - When you assign a value to a variable, what...Ch. 2.3 - Summarize the mathematical order of operations, as...Ch. 2.3 - Prob. 2.23CPCh. 2.3 - Prob. 2.24CPCh. 2.4 - What two items do you usually specify with a...Ch. 2.4 - Does it matter where you write the variable...Ch. 2.4 - What is variable initialization?Ch. 2.4 - Prob. 2.28CPCh. 2.4 - What is an uninitialized variable?Ch. 2.7 - Prob. 2.30CPCh. 2.7 - Prob. 2.31CPCh. 2.7 - Prob. 2.32CPCh. 2 - A error does not prevent the program from running,...Ch. 2 - Prob. 2MCCh. 2 - A(n) _______ is a set of well-defined logical...Ch. 2 - An informal language that has no syntax rules, and...Ch. 2 - A ____ is a diagram that graphically depicts the...Ch. 2 - Prob. 6MCCh. 2 - Prob. 7MCCh. 2 - Prob. 8MCCh. 2 - Prob. 9MCCh. 2 - A(n) _____ is a message that tells (or asks) the...Ch. 2 - A(n) ________ sets a variable to a specified...Ch. 2 - In the expression 12 + 7, the values on the right...Ch. 2 - A(n) _____ operator raises a number to a power. a....Ch. 2 - A(n) _________ operator performs division, but...Ch. 2 - A(n) ____ specifies a variable's name and data...Ch. 2 - Assigning a value to a variable in a declaration...Ch. 2 - Prob. 17MCCh. 2 - Prob. 18MCCh. 2 - A debugging process in which you imagine that you...Ch. 2 - Prob. 20MCCh. 2 - Programmers must be careful not to make syntax...Ch. 2 - In a math expression, multiplication and division...Ch. 2 - Variable names can have spaces in them.Ch. 2 - In most languages, the first character of a...Ch. 2 - Prob. 5TFCh. 2 - In languages that require variable declarations, a...Ch. 2 - Uninitialized variables are a common cause of...Ch. 2 - The value of a named constant cannot be changed...Ch. 2 - Hand tracing is the process of translating a...Ch. 2 - Prob. 10TFCh. 2 - What does a professional programmer usually do...Ch. 2 - What is pseudocode?Ch. 2 - Computer programs typically perform what three...Ch. 2 - What does the term user-friendly mean?Ch. 2 - What two things must you normally specify in a...Ch. 2 - What value is stored in uninitialized variables?Ch. 2 - Design an algorithm that prompts the user to enter...Ch. 2 - Design an algorithm that prompts the user to enter...Ch. 2 - Write assignment statements that perform the...Ch. 2 - Assume the variables result, x, y, and z are all...Ch. 2 - Write a pseudocode statement that declares the...Ch. 2 - Write a pseudocode statement that declares the...Ch. 2 - Write a pseudocode statement that assigns the...Ch. 2 - Write a pseudocode statement that assigns the sum...Ch. 2 - Write a pseudocode statement that subtracts the...Ch. 2 - Write a pseudocode statement that multiplies the...Ch. 2 - If the following pseudocode were an actual...Ch. 2 - Prob. 12AWCh. 2 - If the following pseudocode were an actual...Ch. 2 - If the programmer translates the following...Ch. 2 - The following code will not display the results...Ch. 2 - Find the error in the following pseudocode....Ch. 2 - Find the error in the following pseudocode....Ch. 2 - Find the error in the following pseudocode....Ch. 2 - Find the error in the following pseudocode....Ch. 2 - Personal Information Design a program that...Ch. 2 - Sales Prediction A company has determined that its...Ch. 2 - Land Calculation One acre of land is equivalent to...Ch. 2 - Total Purchase A customer in a store is purchasing...Ch. 2 - Distance Traveled Assuming there are no accidents...Ch. 2 - Sales Tax Design a program that will ask the user...Ch. 2 - Miles-per-Gallon A cars miles-per-gallon (MPG) can...Ch. 2 - Tip, Tax, and Total Design a program that...Ch. 2 - Celsius to Fahrenheit Temperature Converter Design...Ch. 2 - Stock Transaction Program Last month Joe purchased...Ch. 2 - Cookie Calories A bag of cookies holds 40 cookies....Ch. 2 - Male and Female Percentages Design a program that...Ch. 2 - Ingredient Adjuster A cookie recipe calls for the...
Additional Engineering Textbook Solutions
Find more solutions based on key concepts
For each of the following activities, give a PEAS description of the task environment and characterize it in te...
Artificial Intelligence: A Modern Approach
How do you identify the classes in a problem domain description?
Starting Out with C++ from Control Structures to Objects (8th Edition)
Consider the following function definition: void tripler (int n) { n = 3n; } Which of the following are accepta...
Problem Solving with C++ (10th Edition)
What are the four basic arithmetic operations?
Digital Fundamentals (11th Edition)
What does the Program.cs file contain?
Starting out with Visual C# (4th Edition)
Describe the three types of anomalies that can arise in a table and the negative consequences of each.
Modern Database Management (12th Edition)
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- (Misc. application) a. Write a program to reverse the digits of a positive integer number. For example, if the number 8735 is entered, the number displayed should be 5378. (Hint: Use a do statement and continuously strip off and display the number’s units digit. If the variable numinitially contains the number entered, the units digit is obtained as (num % 10). After a units digit is displayed, dividing the number by 10 sets up the number for the next iteration. Therefore, (873510)is5and(8735/10)is873. The do statement should continue as long as the remaining number is not 0.) b. Run the program written in Exercise 3a and verify the program by using appropriate test data.arrow_forward(Statistics) This is the formula for the standard normal deviate, z, used in statistical applications: z=(X)/ X is a single value. refers to an average value. refers to a standard deviation. Using this formula, you need to write a program that calculates and displays the value of the standard normal deviate when X=85.3,=80,and=4. a. For this programming problem, how many outputs are required? b. How many inputs does this problem have? c. Determine a formula for converting input items into output items. d. Test the formula written for Exercise 7c, using the data given in the problem.arrow_forward""" MovieGuide.py This program allows each theater patron to enter a value from 0 to 4 indicating the number of stars that the patron awards to the Guide's featured movie of the week. The program executes continuously until the theater manager enters a negative number to quit. At the end of the program, the average star rating for the movie is displayed. """ # Initialize variables. totalStars = 0 # total of star ratings. numPatrons = 0 # keep track of number of patrons averageStars = 0 numStars = 0 # Get input. numStarsString = input("Enter rating for featured movie: ") # Convert to double. numStars = float(numStarsString) # Write while loop here while numStars >= 0 and numStars <= 4: numPatrons = numPatrons + 1 # incrementor totalStars = totalStars + numStars # Get input. numStarsString = input("Enter rating for featured movie: ") # Convert to double. numStars = float(numStarsString) # Calculate average star rating averageStars - totalStars / numPatrons print("Average…arrow_forward
- Nonearrow_forwardmystery_value = 5 #You may modify the lines of code above, but don't move them!#When you Submit your code, we'll change these lines to#assign different values to the variables. #Write a program that divides mystery_value by mystery_value#and prints the result. If that operation results in an#error, divide mystery_value by (mystery_value + 5) and then#print the result. If that still fails, multiply mystery_value#by 5 and print the result. You may assume one of those three#things will work.##You may not use any conditionals.# #Add your code here!arrow_forward3- Enter a=3; b-5; c=7, then clear the variable b onlyarrow_forward
- Assume 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_forwardMobile Service Provider Write a flowgorithm program that will calculate a person’s mobile phone bill based on plan chosen and the data used. The program should perform the following: Ask for customer’s mobile plan Ask for the number of gigabytes of data used Display an error message if the plan choice is invalid or the gigabytes used is less than zero (0) Mobile data plans are: Plan A 19.99/month, with 4 gigabytes data, additional data $10/gigabyte Plan B 29.99/month, with 8 gigabytes data, additional data $5/gigabyte Plan C 39.99/month, unlimited data Remember the following: use clear prompts for your input label each output number or name use comment box for your name, lab name and date at the top of the flowgorithm use other comments where appropriate use appropriate constantsarrow_forwardAssume the variables result, w, x, y, and z are all integers, and that w = 5, x = 4, y = 8,and z = 2. What value will be stored in result after each of the following statements execute?1. result = x + y2. result = z * 23. result = y / x4. result = y – z5. result = w // zarrow_forward
- Computer Fundamentals and Programming 2 Write a program that determines a student’s grade. The program will accept 3 scores and computes the average score. Determine the grade based on the following rules: - If the average score is equal or greater than 90, the grade is A. - If the average score is greater than or equal to 70 and less than 90, the grade is B. - If the average score is greater than or equal to 50 and less than 70, the grade is C. - If the average score is less than 50, the grade is F. Source Codes and Print Screen of the Outputarrow_forwardFor the following code: for ( a = 1, b = 5, c = 3; a < 4; a++, b++ ) { c = a * b + c; } Indicate what values for the following variable will be when the code endsa=b=c=arrow_forwardTranscribed Image Text Write a program that asks for the principal, the annual interest rate, and the number of times the interest is compounded. It should display a report similar to the following: Interest Rate: 4.25% Times Compounded: 12 Principal: $ 1000.00 Interest: 43.33 Final balance: $ 1043.33arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Programming with Microsoft Visual Basic 2017Computer ScienceISBN:9781337102124Author:Diane ZakPublisher:Cengage LearningMicrosoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,C++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology Ptr
- C++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage Learning
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:9781337102124
Author:Diane Zak
Publisher:Cengage Learning
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
Python Tutorial #10; Math Functions in Python; Author: Art of Engineer;https://www.youtube.com/watch?v=OviXsGf4qmY;License: Standard YouTube License, CC-BY