Write a looping program that presents user with given option

Assignment Help Programming Languages
Reference no: EM131321294

Assignment

Instructions: The following programming problem can be solved by a program that uses three basic tasks-Input Data, Process Data, and Output Results. To process the data, it uses loops, arrays, decisions, accumulating, counting, searching and sorting techniques. Use RAPTOR to design a suitable program to solve this problem.

Problem Statement

Assume the Scores array is parallel to the Players array (both arrays are below).

Scores array
Scores[0] = 198
Scores[1] = 486
Scores[2] = 651
Scores[3] = 185
Scores[4] = 216
Scores[5] = 912
Scores[6] = 173
Scores[7] = 319
Scores[8] = 846
Scores[9] = 989

Players Array
Players[0] = "Joe"
Players[1] = "Ann"
Players[2] = "Marty"
Players[3] = "Tim"
Players[4] = "Rosy"
Players[5] = "Jane"
Players[6] = "Bob"
Players[7] = "Lily"
Players[8] = "Granny"
Players[9] = "Liz"

Write a looping program that presents the user with 3 options:

1) Sort Output by Players
2) Sort Output by Scores
3) Exit Program

When the first option is selected, sort the Players array in alphabetical order, keeping the Scores array parallel. Add code that determines the highest and lowest scores in the list. Include code to display each player's score and name in the sorted order. Below the sorted list display the highest and lowest scores in the list and the name of the player who received that score.

Your sort by Player output display should look like this:

Scores Sorted by Player:
486 Ann
173 Bob
846 Granny
912 Jane
198 Joe
319 Lily
989 Liz
651 Marty
216 Rosy
185 Tim
-----------------------------------
989 Highest Score by Liz
173 Lowest Score by Bob

When the second option is selected, sort the Scores array in numerical order, keeping the Players array parallel. Add code that determines the average score of the entire list. Include code to display each player's score and name in the sorted order. Below the sorted list display the average of all scores in the list. Your sort by Scores output display should look like this:

Players Sorted by Scores:
173 Bob
185 Tim
198 Joe
216 Rosy
319 Lily
486 Ann
651 Marty
846 Granny
912 Jane
989 Liz
---------------------------
498 Average Score

You may use either the Bubble Sort or the Selection Sort algorithms.

Option three is self explanatory. NEVER call "main" from inside your program. Use a loop that keeps your program running until the user chooses option 3.

Round the Average score to the nearest whole number, as shown in the output example above.

You MUST use Modular Programming techniques by using Sub Modules (Sub Charts in RAPTOR) in your program. Your "main" module should not be very large. Again, NEVER call "main" from inside your program. Also, do not use "recursion" in this program (submodules that call themselves). You are only allowed to use looping techniques to repeat sections of your submodules.

You may NOT "hard code" the numbers for highest and lowest scores. Nor simply sort the array by score and use the lowest and highest indexes. These must be discovered through algorithm that will work on an unsorted array. NOR may you "hard code" the number for the average score. Accumulate the scores in a loop then calculate the average. If the array data is changed, the Hi/Low/Avg scores should automatically be found or calculated with the new data.

Hard-code the values of the arrays into your program. Do NOT ask the user to input the values.

Other Requirements:

Documentation: Use the "Comments" feature to document each symbol in the flowchart. You do this by right-clicking the symbol and selecting "Comment." Be sure to identify the data type of each variable used. Be sure to explain what each formula does. Be sure to explain what each of the other symbols in the flowchart does in a comment.

Test and debug your Program: Create sample input data, run the program, then check your answers with a calculator or Excel. If something did not match up, then fix your program.

Program must execute and produce correct output.

Read this page again to be sure you covered all requirements.

See the Programming Project Rubric for grading principles.

1) Add an option to the menu with code that allows the user to type in a Player's name and then displays the Player's score. 2) Use files to input your array data.

Reference no: EM131321294

Questions Cloud

Straight-line to zero over the project four-year life : Kolby’s Korndogs is looking at a new sausage system with an installed cost of $514,000. This cost will be depreciated straight-line to zero over the project’s four-year life, at the end of which the sausage system can be scrapped for $102,000. If the..
Simulate the recursive factorial function given in the class : In this programming assignment, you are asked to simulate the recursive factorial function given in the class. Your program is to be a nonrecursive version of the factorial function implemented using a stack.
Small spherical hollow of radius : A sphere of radius R1 has a uniform charge density ρ within its volume except fora small spherical hollow of radius R2 located a distance a from the center. Find the E ?eld at the center of the hollow, and ?nd the potential at the same point, assu..
Develop an algorithm to move partially dead code : Develop an algorithm to move partially dead code, so expressions are evaluated only where they will eventually be used.
Write a looping program that presents user with given option : Write a looping program that presents the user with 3 options: Sort Output by Players, Sort Output by Scores and Exit Program.
Expansion of the universe led astronomers : The Hubble's discovery of the expansion of the universe led astronomers to conclude that our universe must have started with an extreme conditions event called the Big Bang.
Explain how john could use the balanced scorecard approach : Advise John about the practical aspects of theories that you think are relevant (e.g. best practice, best fit, RBV) in relation to building and growing people and improving business performance; Explain how John could use the Balanced Scorecard App..
What is the temperature inside the furnace : The blackbody radiation emitted from a furnace peaks at a wavelength of 2.7 10-6 m(0.0000027 m). What is the temperature inside the furnace?
Aircraft equipped with powerful radar units : Aircraft equipped with powerful radar units are forbidden from turning them on when on the ground near people. Explain why this is so.

Reviews

Write a Review

Programming Languages Questions & Answers

  Designing class to denote person-s height

Design a class, PersonHeight, to denote the person's height. Our class will include the following members.

  Write program that asks user for two digit number

Write program which asks user for two digit number and then prints English word for that number. Sample run: Enter a two-digit number: 45

  Compute the trajectory of the particle

Your program should then compute the trajectory of the particle and display the motion of the particle as an animation in 3 dimensions

  Implement the curried functions in ocaml

Goal of this project is to get you familiar with programming in OCaml. You will have to write a number of small functions - write a helper function which will add another 3-6 lines.

  Write a program that takes a single directory as an argument

Write a program that takes a single directory as an argument, and iterates through all the normal files in the directory, and concatenate them to standard out.

  Put the commands into a file

get the accounts from /etc/passwd where the person's name starts with A-G. (Look at the full names and just the first letter of the first name in the field.)

  Develop a program to determine the final scores

In this project, you will develop a program to determine the final scores, letter grades, and rankings of all students in a course. All records of the course will be stored in an input file, and a record of each student will include the first name..

  Create a "exit" button that exits the program

Develop a GUI program that will determine the pay for several employees.

  Create new program which prompts user for numbers

Create a new program whihc prompts a user for numbers and determines total revenue using following formula: Total Revenue = Price * Quantity.

  How you take care of these missed values

For the assignment, assume that the sensed data are be generated randomly either by a random number generator in your program or read a triplet every time from a file which is pre@generated).

  Create a rexx program that asks a user for separate lines

Create a REXX program that asks a user for four separate lines of input, and then outputs those lines all at once, one line at a time

  Create an application in which a user can enter a phone book

Create an application in which a user can enter a phone book entry, including the following elements

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd