Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I want that in ruby Your objective in this assignment is to create a program that uses data within files to display a list of

image text in transcribed
I want that in ruby
Your objective in this assignment is to create a program that uses data within files to display a list of Major League baseball World Series winners and tell the user how many times a given team has won the World Series over its history. Records exist from 1903 through 2017. The data is stored in two text files that accompany the assignment. The first file, teams.txt, contains an alphabetical list of teams who have won at least once. The second file, winners.txt, contains a chronological list of the winning teams from 1903 through 2017. (The first line shows the team that won in 1903, and the last line shows the team that won in 2017. Note that the World Series was not played in 1904 and 1994.) Your program should bring up a menu with the three choices shown below: 1. Show Major League winners 2. Show number of wins for a team 3. Exit The menu options should operate as follows: 1. The first choice simply shows the list of winning teams in alphabetical order. 2. The second choice asks the user for a team and, if valid, displays the number of times the team has won the World Series. Hint: To get the count, read the contents of the winners.txt file into an array. When the user selects a team, an algorithm should step through the array counting the number of times the selected team appears. 3. The menu should continue to appear until the user selects the third choice, which will terminate the data files from Blackboard and put them in the same folder. Build a list of comments that constitute an program. Use your knowledge of Ruby and build the program in a file named Asg11.rb. Download the algorithm, and then write the code to implement it. Make sure you document your program and consistently follow style guidelines, which include blank spaces between functional sections of code, naming variables properly, and adding comments where the purpose of a line of code is not immediately obvious by itself. Your objective in this assignment is to create a program that uses data within files to display a list of Major League baseball World Series winners and tell the user how many times a given team has won the World Series over its history. Records exist from 1903 through 2017. The data is stored in two text files that accompany the assignment. The first file, teams.txt, contains an alphabetical list of teams who have won at least once. The second file, winners.txt, contains a chronological list of the winning teams from 1903 through 2017. (The first line shows the team that won in 1903, and the last line shows the team that won in 2017. Note that the World Series was not played in 1904 and 1994.) Your program should bring up a menu with the three choices shown below: 1. Show Major League winners 2. Show number of wins for a team 3. Exit The menu options should operate as follows: 1. The first choice simply shows the list of winning teams in alphabetical order. 2. The second choice asks the user for a team and, if valid, displays the number of times the team has won the World Series. Hint: To get the count, read the contents of the winners.txt file into an array. When the user selects a team, an algorithm should step through the array counting the number of times the selected team appears. 3. The menu should continue to appear until the user selects the third choice, which will terminate the data files from Blackboard and put them in the same folder. Build a list of comments that constitute an program. Use your knowledge of Ruby and build the program in a file named Asg11.rb. Download the algorithm, and then write the code to implement it. Make sure you document your program and consistently follow style guidelines, which include blank spaces between functional sections of code, naming variables properly, and adding comments where the purpose of a line of code is not immediately obvious by itself

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions