You must enhance the code provided as follows: 1. Add the missing code to the function/method...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
You must enhance the code provided as follows: 1. Add the missing code to the function/method read_album () 2. Add the missing code to the procedure/method print_album () 3. Optional: Add an initialize() method to the Album class/record definition. The code should work similar to the following when run: Enter Album Enter album name: Greatest Hits Enter artist name: Don McClean Enter Genre between 1 - 4: 2 Album information is: Greatest Hits Don McClean Genre is 2 Classic Once your program is running upload a screenshot to the workspace. Video 2 input functions.rb music_record.rb + input_functions.rb music_record.rb 1 # Display the prompt and return the read string 2 def read_string prompt 3 4 5 end 6 # Display the prompt and return the read float 7 def read_float prompt 8 9 10 end 11 12 # Display the prompt and return the read integer 13 def read_integer prompt 14 15 16 end 17 18 # Read an integer between min and max, prompting with the string provided 19 puts prompt value=gets.chomp end value= read_string(prompt) value.to_f 20 def read_integer_in_range (prompt, min, max) 21 value= read_integer (prompt) 22 while (value < min or value > max) 23 puts "Please enter a value between "+min.to_s+ " and "+max.to_s + ": " value= read_integer (prompt); 24 25 26 27 28 29 # Display the prompt and return the read Boolean 30 31 def read_boolean prompt 32 33 34 35 36 37 38 39 end value= read_string(prompt) value.to_i end end value value = read_string(prompt) case value when 'y', 'yes', 'Yes', 'YES' true else end false 40 41 # Test the functions above 42 43 def main 44 45 46 47 48 49 50 main if __FILE__ == $0 puts "String entered is: " + read_string("Enter a String: ") puts "Boolean is: " + read_boolean("Enter yes or no:").to_s puts "Float is: " + read_float("Enter a floating point number: ").to_s puts "Integer is: " + read_integer_in_range("Enter an integer between 3 and 6: ", 3, 6).to_s Description ✓ Feedback Not yet TESTCASES basic test Your program produced no output. +Enter Album +Enter album name: +Enter artist name: + Enter Genre between 1 - 4: + Album information is: + Greatest Hits + Don McClean + Genre is 2 + Classic Show explanation DIFF SPLIT DIFF YOUR OUTPUT EXPECTED 0/1 passed TESTCASES ✓basic test Your program produced no output. No output DIFF SPLIT DIFF YOUR OUTPUT EXPECTED 0/1 passed X You must enhance the code provided as follows: 1. Add the missing code to the function/method read_album () 2. Add the missing code to the procedure/method print_album () 3. Optional: Add an initialize() method to the Album class/record definition. The code should work similar to the following when run: Enter Album Enter album name: Greatest Hits Enter artist name: Don McClean Enter Genre between 1 - 4: 2 Album information is: Greatest Hits Don McClean Genre is 2 Classic Once your program is running upload a screenshot to the workspace. Video 2 input functions.rb music_record.rb + input_functions.rb music_record.rb 1 # Display the prompt and return the read string 2 def read_string prompt 3 4 5 end 6 # Display the prompt and return the read float 7 def read_float prompt 8 9 10 end 11 12 # Display the prompt and return the read integer 13 def read_integer prompt 14 15 16 end 17 18 # Read an integer between min and max, prompting with the string provided 19 puts prompt value=gets.chomp end value= read_string(prompt) value.to_f 20 def read_integer_in_range (prompt, min, max) 21 value= read_integer (prompt) 22 while (value < min or value > max) 23 puts "Please enter a value between "+min.to_s+ " and "+max.to_s + ": " value= read_integer (prompt); 24 25 26 27 28 29 # Display the prompt and return the read Boolean 30 31 def read_boolean prompt 32 33 34 35 36 37 38 39 end value= read_string(prompt) value.to_i end end value value = read_string(prompt) case value when 'y', 'yes', 'Yes', 'YES' true else end false 40 41 # Test the functions above 42 43 def main 44 45 46 47 48 49 50 main if __FILE__ == $0 puts "String entered is: " + read_string("Enter a String: ") puts "Boolean is: " + read_boolean("Enter yes or no:").to_s puts "Float is: " + read_float("Enter a floating point number: ").to_s puts "Integer is: " + read_integer_in_range("Enter an integer between 3 and 6: ", 3, 6).to_s Description ✓ Feedback Not yet TESTCASES basic test Your program produced no output. +Enter Album +Enter album name: +Enter artist name: + Enter Genre between 1 - 4: + Album information is: + Greatest Hits + Don McClean + Genre is 2 + Classic Show explanation DIFF SPLIT DIFF YOUR OUTPUT EXPECTED 0/1 passed TESTCASES ✓basic test Your program produced no output. No output DIFF SPLIT DIFF YOUR OUTPUT EXPECTED 0/1 passed X
Expert Answer:
Answer rating: 100% (QA)
Program require inputfunctions module Genre POP CLASSIC JAZZ ROCK 14 end Maybe the following needs t... View the full answer
Related Book For
Income Tax Fundamentals 2013
ISBN: 9781285586618
31st Edition
Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill
Posted Date:
Students also viewed these programming questions
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
This assignment reviews object-oriented programming concepts such as classes, methods, constructors, accessor methods, and access modifiers. It makes use of an array of objects as a class data...
-
THIRD AVENUE SOFTWARE HEALTH-CARE APP PROJECT This case is new for the ninth edition of Information Technology Project Management . The case provides an opportunity to apply agile and Scrum...
-
Two companies, Energen and Hastings Corporation, began operations with identical balance sheets. A year later, both required additional manufacturing capacity at a cost of $50,000. Energen obtained a...
-
Allene (1, 2-propadiene), H2C = C = CH2, has two adjacent double bonds. What kind of hybridization must the central carbon have? Sketch the bonding orbitals in allene. What shape do you predict for...
-
The Hubble Space Telescope uses a mirror of radius 1.2 m. Is its resolution better when detecting visible light or UV? Explain.
-
Journals, subsidiary ledgers and control accounts Cavuilati and Companys Accounts Receivable control account in the general ledger on 1 March was \($12\) 090. The subsidiary ledger contained the...
-
Upland Company borrowed $40,000 on November 1, 2010, by signing a $40,000, 9%, 3-month note. Prepare Uplands November 1, 2010, entry; the December 31, 2010, annual adjusting entry; and the February...
-
* Installing integrated software needs more memory than installing many .standalone applications True O False
-
Name some users of accounting information.
-
Choose the correct type of introduction. Only one option is correct. 5. It was the first day of 2 points September in 1986, and the morning rain had given way to bright sunshine. A successful...
-
Implement a class Quiz that implements the Measurable interface of Exercise E10.1. A quiz has a score and a letter grade (such as B+). Modify the Data class from Section 10.1 to process an array of...
-
Write a program LineDistanceTester that constructs a line joining the points (100, 100) and (200, 200), then constructs points (100, 200), (150, 150), and (250, 50). Print the distance from the line...
-
Why does the argument of the paintComponent method have type Graphics and not Graphics2D?
-
Can a class be an event source for multiple event types? If so, give an example.
-
What happens in our implementation of the BankAccount class when more money is withdrawn from the account than the current balance?
-
To calibrate a prism spectrometer, a student sends light of 10different known wavelengths ? throughthe spectrometer and measuresthe angle ? by which each beam is deflected. Using these results,he...
-
Without solving, determine the character of the solutions of each equation in the complex number system. 3x 2 3x + 4 = 0
-
Harold Conners (Social Security number 785-23-9873) lives at 13234 DeMilo Drive, Houston, TX 77052, and is self-employed for 2012. He estimates his required annual estimated tax payment for 2012 to...
-
Robert Ramos (age 36) is a single taxpayer, living at 8765 Bay Dr., Monterey, CA 93940. His Social Security number is 976-23-5132. Robert's earnings and income tax withholding as the manager of a...
-
Carl and Jenny adopt a Russian orphan. The adoption takes 2 years and two trips to Russia and is final in 2012. They pay $6,000 in 2011 and $7,500 in 2012 of qualified adoption expenses, and have AGI...
-
Complete the following sentences: system is also called a distributed data and application client/server system or
-
The textbook states that "data is a resource that must be controlled and managed." Explain this statement, and indicate whether you agree of not, and why.
-
Why do conventional files tend be have duplication of data?
Study smarter with the SolutionInn App