Question: Disclaimer if coding is needed: THIS IS A PSEUDO CODE CLASS 1 . The programmer intends for this pseudocode to display three random numbers in

Disclaimer if coding is needed: THIS IS A PSEUDO CODE CLASS 1. The programmer intends for this pseudocode to display three random numbers in the range of 1 through 7. According to the way we've been generating random numbers in this book, however, there appears to be an error. Can you find it?
```
// This program displays three random numbers
// in the range of 1 through 7.
```
Declare Integer count
// Display three random numbers.
For count \(=1\) To 3
Display random(7,1)
End For
2. Can you find the reason that the following pseudocode function does not return the value indicated in the comments?
// The calcDiscountPrice function accepts an item's price and
// the discount percentage as arguments. It uses those
// values to calculate and return the discounted price.
Function Real calcDiscountPrice(Real price, Real percentage)
// Calculate the discount.
Declare Real discount = price * percentage
// Subtract the discount from the price.
Declare Real discountPrice \(=\) price - discount
// Return the discount price.
Return discount
End Function 3. Can you find the reason that the following pseudocode does not perform as indicated in the comments?
// Find the error in the following pseudocode.
Module main()
Declare Real value, result
// Get a value from the user.
Display "Enter a value."
Input value
// Get 10 percent of the value.
Call tenPercent(value)
// Display 10 percent of the value.
Display "10 percent of ", value, " is ", result
End Module
// The tenPercent function returns 10 percent
// of the argument passed to the function.
Function Real tenPercent(Real num)
Return num *0.1
End Function
Disclaimer if coding is needed: THIS IS A PSEUDO

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!