Question: Hi Chegg Expert, Please do In the BELOW QUESTION IN RUBY SHOW EXAMPLE ALSO. PLEASE DO AS SOON AS POSSIBLE. A student collects copies of
Hi Chegg Expert, Please do In the BELOW QUESTION IN RUBY SHOW EXAMPLE ALSO. PLEASE DO AS SOON AS POSSIBLE.

A student collects copies of scientific papers. Create a Ruby class Paper1. Each paper is characterized by the instance variables author and title. For this class create the initializer and the method show1 that displays the instance variables of the class Paper1. Create the class Paper2 that inherits properties from the class Paper1 and adds a new instance variables journal and price. Write the following Paper2 methods: read2 that prompts the user and reads from the keyboard all data for Paper2. show2 that displays all instance variables of the class Paper2. Write a main program that first reads from the keyboard an array of 3 papers (objects of Paper2). Then the program displays all of them using show2, and computes and displays the total cost of all papers. After that, write all prices in file papers.txt, one price per line, and close the file
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
