Question

The programmer intends for this pseudocode to display three random numbers in the range of 1...

The programmer intends for this pseudocode to display three random numbers in the range of 1 through 10. Locate the error and clearly explain the error.

// This program displays three random numbers in the range of 1 through 10. Declare Integer count Declare Real value

// Display three random numbers.

For count = 1 To 5 Step 2

Set value = count

Display random(10, 1)

End For

Homework Answers

Answer #1

// This program displays three random numbers in the range of 1 through 10.

Declare Integer count // this line declares count as integer

Set count = 1 //initialize the count to 0, so that it can be incremented upon the count

Declare Real value //this line declares value as real number

// Display three random numbers.

For count = 1 To 3 Step 2 //The error was here, we should run the for loop 3 times, but in psuedo code it was 5

Set value = random(10,1) //set the random value to a value in the range 1->19  

Display value //display the value(obtained in previous step)

Set count = count + 1 //increase the count iterator, which is used as the iterator in for loop

End For

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
1) Write a java programming using a while loop where you will add numbers and when...
1) Write a java programming using a while loop where you will add numbers and when you press number 0 it will add all your numbers and display the results. Use Scanner object. Steps: 1) Declare variables integer called sum which is equal to zero   2) Declare Scanner object   3) Declare while condition where is true   4) Inside of that condition prompt the user to enter the numbers   5) Declare variable integer called number and input the number statement   6)...
Lottery The lottery game matches three different integer numbers between 1 and 10. Winning depends on...
Lottery The lottery game matches three different integer numbers between 1 and 10. Winning depends on how many matching numbers are provided by a player. The player provides three different integers between 1 and 10. If there is a match of all 3 numbers, the winning $ 1000. If there is a match with 2 numbers, the winning $ 10. If there is a match with 1 number, the winning $ 1. With no match, the winning is $0. Write...
Write a program display the following menu: Ohms Law Calculator 1. Calculate Resistance in Ohms 2....
Write a program display the following menu: Ohms Law Calculator 1. Calculate Resistance in Ohms 2. Calculate Current in Amps 3. Calculate Voltage in volts 4. Quit Enter your choice (1-4) If the user enters 1, the program should ask for voltage in Volts and the current in Amps. Use the following formula: R= E/i Where: E= voltage in volts I= current in amps R= resistance in ohms If the user enters 2 the program should ask for the voltage...
1. Let x be a continuous random variable. What is the probability that x assumes a...
1. Let x be a continuous random variable. What is the probability that x assumes a single value, such as a (use numerical value)? 2. The following are the three main characteristics of a normal distribution. The total area under a normal curve equals _____. A normal curve is ___________ about the mean. Consequently, 50% of the total area under a normal distribution curve lies on the left side of the mean, and 50% lies on the right side of...
Part A. Input Validation (Name your C program yourLastName_yourFirstName_Lab4a.c) 1. Place the code you developed in...
Part A. Input Validation (Name your C program yourLastName_yourFirstName_Lab4a.c) 1. Place the code you developed in Lab 2 to obtain a diameter value from the user and compute the volume of a sphere (we assumed that to be the shape of a balloon) in a new program, and implement the following restriction on the user’s input: the user should enter a value for the diameter which is at least 8 inches but not larger than 60 inches. Using an if-else...
Visit the NASDAQ historical prices weblink. First, set the date range to be for exactly 1...
Visit the NASDAQ historical prices weblink. First, set the date range to be for exactly 1 year ending on the Monday that this course started. For example, if the current term started on April 1, 2018, then use April 1, 2017 – March 31, 2018. (Do NOT use these dates. Use the dates that match up with the current term.) Do this by clicking on the blue dates after “Time Period”. Next, click the “Apply” button. Next, click the link...
ASSIGNMENT Customer Lifetime Value STEP 1: CONSIDER RELEVANT NUMBERS Netflix obtains paying subscribers through unique deals...
ASSIGNMENT Customer Lifetime Value STEP 1: CONSIDER RELEVANT NUMBERS Netflix obtains paying subscribers through unique deals like bundles and discount. Here are numbers to use in order to calculate metrics for this assignment: ● Customers pay $12.99/month for a subscription ● The average subscription length is 25 months. Customer lifetime revenue = ($12.99 X 25 = $324.75) ● Cost to acquire and maintain each subscriber = $99 ● Annual Retention rate = 60 percent ● Annual Discount rate = 10...
1. A random number generator is used to select a number from 1 to 500 ?(inclusively)....
1. A random number generator is used to select a number from 1 to 500 ?(inclusively). What is the probability of selecting the number 595 ? What is the probability? 2.Identify the sample space of the probability experiment and determine the number of outcomes in the sample space. -Randomly choosing an even number between 10 and 20, inclusive The sample space is? (Use a comma to separate answers) There are _____ outcomes in the sample space 3. Determine the number...
Java question, Please answer everything. Thank you Answer the following questions as briefly (but completely) as...
Java question, Please answer everything. Thank you Answer the following questions as briefly (but completely) as possible: What is a checked exception, and what is an unchecked exception? What is NullPointerException? Which of the following statements (if any) will throw an exception? If no exception is thrown, what is the output? 1: System.out.println( 1 / 0 ); 2: System.out.println( 1.0 / 0 ); Point out the problem in the following code. Does the code throw any exceptions? 1: long value...
IntList Lab Specifications You are required to come up with a single header file (IntList.h) that...
IntList Lab Specifications You are required to come up with a single header file (IntList.h) that declares and implements the IntNode class (just copy it exactly as it is below) as well as declares the IntList Class interface only. You are also required to come up with a separate implementation file (IntList.cpp) that implements the member functions of the IntList class. While developing your IntList class you must write your own test harness (within a file named main.cpp). Never implement...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT