Chap 1 - Debugging Examples

¡Supera tus tareas y exámenes ahora con Quizwiz!

// This program accepts a user's monthly pay, rent, utilities, and grocery bills and displays the amount available for discretionary // spending (which might be negative). Modify the program to output the pay and the total bills as well as the remaining // discretionary amount start input pay input rent input utilities input groceries discretionary = pay - rent - utlilities - groceries output discretionary stop To fix this, the program should be changed to the following: start input pay input rent input utilities input groceries ____________________ = rent + utlilities + groceries discretionary = pay - _____________________________ output pay output ________________________ output discretionary stop

// This program accepts a user's monthly pay, rent, utilities, and grocery bills and displays the amount available for discretionary // spending (which might be negative). Modify the program to output the pay and the total bills as well as the remaining // discretionary amount start input pay input rent input utilities input groceries discretionary = pay - rent - utlilities - groceries output discretionary stop To fix this, the program should be changed to the following: start input pay input rent input utilities input groceries [totalBills] = rent + utlilities + groceries discretionary = pay - [totalBills] output pay output [totalBills] output discretionary stop

// This pseudocode is intended to compute the number // of miles per gallon you get with your automobile. start input milesTraveled input gallonsOfGasUsed milesPerGallon = milesTraveled (___) __________ output __________________ start

// This pseudocode is intended to compute the number // of miles per gallon you get with your automobile. start input milesTraveled input gallonsOfGasUsed milesPerGallon = milesTraveled [/] gallonsOfGasUsed output milesPerGallon start

// This pseudocode is intended to describe // computing the price of an item on sale for 10% off start input origPrice discount = _______ * _______ finalPrice = origPrice - ___________ output _________ stop

// This pseudocode is intended to describe // computing the price of an item on sale for 10% off start input origPrice discount = origPrice * 0.10 finalPrice = origPrice - discount output finalPrice stop


Conjuntos de estudio relacionados

ch 8-Business Plans: seeing your audiences and your business clearly

View Set

Chapter 4 - Central nervous system, peripheral nervous system & neurons: structure & function

View Set

policy riders, provisions, options, and exclusions.

View Set

MGT 300: EXAM III Quizzes Flores

View Set

ENG1D1 - Short Stories Unit Test

View Set

Principles of Real Estate Chapter 15

View Set