0% found this document useful (0 votes)
5 views5 pages

Chapter 1 Assignment Overview

The document contains pseudocode algorithms and flowcharts for calculating sales tax, account balances, and predicting results of mathematical expressions. It includes steps to get user input, perform calculations, and display outputs. Chapter assignments are for an algorithms course and cover topics like available credit, sales tax rates, account balances, and identifying errors in pseudocode.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views5 pages

Chapter 1 Assignment Overview

The document contains pseudocode algorithms and flowcharts for calculating sales tax, account balances, and predicting results of mathematical expressions. It includes steps to get user input, perform calculations, and display outputs. Chapter assignments are for an algorithms course and cover topics like available credit, sales tax rates, account balances, and identifying errors in pseudocode.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Chapter 1 Assignments

Created by Khang Quach on 2/22/2024

Assignments by Professor Quach

Algorithm Workbench
30. Available Credit

Hierarchy chart

Available Credit

Display the message Display the message Subtract the amount Display the amount of
“Enter the customer’s “Enter the amount of of the credit used available credit of the
maximum credit.” credit used by the from the maximum costumer
customer.” credit

Wait for the Wait for the user


user to enter to enter the
customer’s credit
used
31. Sales Tax

Flowchart

Start A

Calculate the sales tax


for the purchase
Ask user “Enter the
price of the item
being purchased”

Calculate the total of


the sale
Read price

Display the sales tax


for the purchase and
Ask user “Enter total of the sale
the sales tax rate”

End
Read sales
tax rate

A
32. Account Balance

Hierarchy chart

Account Balance

The starting The total dollar The total dollar The Calculate and
balance amount if deposits amount of monthly display account
made withdrawals made interest Balance
rate

Predict the Result


33.

x=0

y=5

x= x + 1 = 0 + 1 = 1

y= y + 1 = 5 + 1 = 6

y= x + y = 1 + 6 = 7

“7” will be displayed on screen


34.

j = 10

k=2

l=4

j = j * k = 10 * 2 = 20

l=l*k=2*4=8

k = j + l = 20 + 8 = 28

“28” will be displayed on the screen

35.

a=1

b = 10

c = 100

x=0

x = c * 3 = 100 * 3 = 300

x = 300 + b * 6 = 300 + 10 * 6 = 360

x = 360 + a * 5 = 360 + 1 * 5 = 365

“ 365 “ will be displayed on the screen


36.

The error is “area = width X length.”

The program will calculate the area first but it does not get any value from the user input. We need the
input first and we put the calculation after all the input width and length.

The pseudocode algorithm should be:

Display “What is the room’s width?”.

Input width.

Display “What is the room’s length?”.

Input length.

area = width x length.

Display area.

You might also like