Basic Programming Principles 2nd Edition by CM Pretorius and HG Erasmus. Insightful answers to the chapter questions. Really helpful for exams and assignments. Provides sequential steps to assist chapter answers.
basic programming principles 2nd edition cm pretorius an
Written for
University of South Africa (Unisa)
ICT1511 - Introduction to Programming (ICT1511)
All documents for this subject (5)
Seller
Follow
kaylenpillay
Content preview
Chapter 3 Answers
Exercises Page 48
Question 1
1.1
Planning:
Description Type Variable name
Input Name of item string name
Price of item real price
Output Name of item String name
Price of item real price
IPO chart:
Input Processing Output
name Prompt for input data name
price Enter input data price
Display output data
Algorithm:
ShowItemData
~ get the input
display “Provide the name” ~ on new line
enter name
display “Provide the price” ~ on new line
enter price
~ show output on screen
display “The name of the item is “, name ~ on new line
display “The price of the item is R”, price ~ on new line
end
Trace Table:
Test data: name = t-shirt and price = R29.70
Instruction name price output
display Provide the name
enter t-shirt
display Provide the price
enter 24.70
display The name of the item is t-shirt
display The price of the item is R29.70
Basic Programming Principles Second Edition Chapter 3 Answers
Page 1 of 12
, 1.2
Planning:
Description Type Variable name
Input First number integer number1
Second number integer number2
Output Sum of numbers integer sum
Difference between numbers integer difference
Product of numbers integer product
IPO chart:
Input Processing Output
number1 Prompt for 2 numbers sum
number2 Enter input numbers difference
Calculate output values product
Display output values
Algorithm:
ShowItemData
~ get the input
display “Provide the first number” ~ on new line
enter number1
display “Provide the second number” ~ on new line
enter number2
~ do calculations
sum = number1 + number2
difference = number1 – number2
product = number1 * number2
~ show output on screen
display “The sum is “, sum ~ on new line
display “The difference is ”, difference ~ on new line
display “The product is “, product ~ on new line
end
1.3
Planning:
Description Type Variable name
Input Number chairs per row Integer chairs
Number of rows integer rows
Output Total number of chairs integer totalChairs
IPO chart:
Input Processing Output
chairs Prompt for input data totalChairs
rows Enter input data
Calculate totalChairs
Display totalChairs
Basic Programming Principles Second Edition Chapter 3 Answers
Page 2 of 12
The benefits of buying summaries with Stuvia:
Guaranteed quality through customer reviews
Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.
Quick and easy check-out
You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.
Focus on what matters
Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!
Frequently asked questions
What do I get when I buy this document?
You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.
Satisfaction guarantee: how does it work?
Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.
Who am I buying these notes from?
Stuvia is a marketplace, so you are not buying this document from us, but from seller kaylenpillay. Stuvia facilitates payment to the seller.
Will I be stuck with a subscription?
No, you only buy these notes for $4.42. You're not tied to anything after your purchase.