Question

In Small Basic Write a program that asks the user how many numbers s/he wishes to...

In Small Basic

Write a program that asks the user how many numbers s/he wishes to enter into an array and then enters a

loop and proceeds to get those numbers from the user and enter them into the array. Once the array has been

filled with the numbers, your program then asks the user to make a choice indicating what s/he wishes to do

with the numbers in the array.

The choices are:

TextWindow.WriteLine("Enter 1 to compute and display the average of the numbers.")

TextWindow.WriteLine("Enter 2 to search for a number and write out that number’s index.")

Note: Assume that each number is unique so there is only one occurrence of each number.

TextWindow.WriteLine("Enter 3 to display the numbers in reverse order.")

TextWindow.WriteLine("Press Enter to quit.")

If the user chooses option 1, your program computes and displays the average of the numbers in the array.

If the user chooses option 2, your program asks the user what number they wish to search for and then does a

search for that number and, if the number is found, displays that number’s index and, if the number is not

found, displays “Number Not Found”.

If the user chooses option 3, your program displays the numbers in the opposite order in which they were

entered.

If the user chooses option 4, your program ends.

Hint: This program will require loops nested within an if-elseif statement

Please note: For Option 3, there is no need to sort the numbers in any order. All you have to do is

display them in the opposite order in which they were entered.

For example, if your array was entered as

5

8

2

9

Option 3 would display the array as

9

2

The language is Small Basic.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Program:

Output:

Enter the number of elements of array:
5
Enter the array elements:
1
3
5
7
9
Enter 1 to compute and display the average of the numbers.
Enter 2 to search for a number and write out that number’s index.
Enter 3 to display the numbers in reverse order.
Press Enter to quit.
1
Average is 5
Enter 1 to compute and display the average of the numbers.
Enter 2 to search for a number and write out that number’s index.
Enter 3 to display the numbers in reverse order.
Press Enter to quit.
2
Enter a number you want to search:
7
Number is Found at 4
Enter 1 to compute and display the average of the numbers.
Enter 2 to search for a number and write out that number’s index.
Enter 3 to display the numbers in reverse order.
Press Enter to quit.
3
Reverse order:
9
7
5
3
1
Enter 1 to compute and display the average of the numbers.
Enter 2 to search for a number and write out that number’s index.
Enter 3 to display the numbers in reverse order.
Press Enter to quit.
4
Bye
Program has ended.

Add a comment
Know the answer?
Add Answer to:
In Small Basic Write a program that asks the user how many numbers s/he wishes to...
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. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • write a program code that asks the user how many numbers they wish to find the...

    write a program code that asks the user how many numbers they wish to find the statistics of and then asks the user to enter those numbers. The program must then calculate and display the average variance and standard deviation of the numbers entered by the user. the program code must -ask three user how many numbers they wish to find the statistics of -ask the user to enter those numbers and store them in an array - use a...

  • Write a C program that asks the user to enter two real numbers. Then your program...

    Write a C program that asks the user to enter two real numbers. Then your program displays a menu that asks the user to choose what arithmetic operation to be done on those numbers. Depending on the user's entry, the program should display the result to the screen. The sample runs below show what should be done to the numbers entered by the user. Your program should run exactly like shown in the sample runs. make your code run as...

  • (C programing, Not C++) Write a program in C that asks the user to input 10...

    (C programing, Not C++) Write a program in C that asks the user to input 10 numbers. Store these numbers in an array. Then ask the user to input a single number. Your program should execute a linear search on the array, trying to find that number. If the number exists in the array, have the program print out which position/element the number was found at. If the target number is not in the array, have the program print out...

  • Design a program that asks the user to enter a series of 20 numbers. The program...

    Design a program that asks the user to enter a series of 20 numbers. The program should store the numbers in the array and then display the following data: The lowest number in the array The highest number in the array The total of the number in the array The average of the numbers in the array PLEASE GIVE THE PSEUDOCODE AND CODE IN C PROGRAMMING

  • Write a program that asks the user to enter number, and displays all the numbers that...

    Write a program that asks the user to enter number, and displays all the numbers that are multiples of 2 and 5 smaller than or equal to the number entered by the user. Hint: A number n is a multiple of 2 if the remainder of the division of n by 2 is equal to zero. Your program should have an output similar to the following: Please enter a number: 50 The multiples of 2 and 5 less than or...

  • In C++ 1. Write a program that allows a user to enter 10 integer values from...

    In C++ 1. Write a program that allows a user to enter 10 integer values from the keyboard. The values should be stored in an array. 2. The program should then ask the user for a number to search for in the array: The program should use a binary search to determine if the number exists in a list of values that are stored in an array (from Step #1). If the user enters a number that is in the...

  • Write a program that will create an array of ten integers, allow the user to enter...

    Write a program that will create an array of ten integers, allow the user to enter those integers, and eventually search through the array based on index position: 1. Declare the array. You cannot assign elements to an array until it has first been created. 2. Next, run a for loop so that the user can enter an integer to save in each index position of the array. Since you this array holds ten elements , the index position starts...

  • Write a program that asks the user to enter two numbers. Then compare the two numbers....

    Write a program that asks the user to enter two numbers. Then compare the two numbers. Display either:     "The first number is larger", or     "The second number is larger", or     "The numbers are the same".

  • Write a program that lets the user enter 10 values into an array. The program should...

    Write a program that lets the user enter 10 values into an array. The program should then display the largest and the smallest values stored in the array. The program should display the following message to the user at the beginning "This program will ask you to enter ten values. Then it will determine the largest and smallest of the values you entered.Please enter 10 integers separated by spaces: " And then after user entered the numbers, it should display...

  • Write a program named ClassifyScores that classifies a series of scores entered by the user into...

    Write a program named ClassifyScores that classifies a series of scores entered by the user into ranges (0-9, 10-19, and so forth). The scores will be numbers between 0 and 100. Design and implement a program to prompt the user to enter each score separately. If the score is within the correct range, then increment the appropriate range If the score entered is greater than 100, display an error message, ignore the incorrect score, and prompt for the user to...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT