Great Deal! Get Instant $25 FREE in Account on First Order + 10% Cashback on Every Order Order Now

Final Project CIS 116 Computer Programming I This 65-point assignment requires you to create a program using the Ruby language to implement creating objects from data that is read from a file, storing...

Final Project CIS 116 Computer Programming I

This 65-point assignment requires you to create a program using
the Ruby language to implement creating objects from data that is
ead from a file, storing the objects in an a
ay, and writing the
objects stored to a file. You will have to use inheritance to
implement a hierarchy of tickets, general admission (GA) tickets
and reserved tickets. Your program will be stored in a file named
Final_project_your_last_name.
. Follow the instructions
presented below to complete the program.

Objective

A movie theater needs a program to read names and ages along
with other ticket information from an input file and write all the
ticket buyer´s names and ages along with the ticket price, type of
ticket, and assigned seating to an output file. The ticket price is
ased on the buyer´s age and the type of ticket, either general
admission (GA) or reserved. For GA tickets, If the ticket buyer is
12 or under, the ticket price is $5. If the ticket buyer is 13 to 64,
inclusive, the ticket price is $10. If the ticket buyer is 65 or older
the ticket price is $8. For reserved tickets, If the ticket buyer is 12
or under, the ticket price is $12. If the ticket buyer is 13 to 64,
inclusive, the ticket price is $25. If the ticket buyer is 65 or older
the ticket price is $20. After each object is created using the
name and age, use a method to calculate the ticket price and set
the ticket price accordingly in your new object. Then store the
fully populated object in our a
ay. When the end of the input file
is reached, write all the ticket buyers’ names, ages, ticket prices,
and section for GA or row/seat number for reserved to an output
file.

Requirements

- Beginning with a class named something appropriate such as
‘Ticket’, use inheritance to create a hierarchy that can represent
general admission tickets and reserved tickets.
- Read each ticket type (GA or reserved), name, age, section or
ow/seat number from a line in an input file.
- After each line is read, use a method to calculate the ticket price
and set the ticket price accordingly in your new object. For GA
tickets, If the ticket buyer is 12 or under, the ticket price is $5. If
the ticket buyer is 13 to 64, inclusive, the ticket price is $10. If the
ticket buyer is 65 or older the ticket price is $8. For reserved
tickets, If the ticket buyer is 12 or under, the ticket price is $12. If
the ticket buyer is 13 to 64, inclusive, the ticket price is $25. If the
ticket buyer is 65 or older the ticket price is $20.
- If the ticket type is ´ga´ you must create an object of your child
class representing general admission tickets with a section that
you read from the input file
- If the ticket type is ´r´ you must create an object of your child
class representing reserved seats with a row and seat number
that you read from the input file.
- Store the type, name, age, section or row/seat number and
ticket_price in an appropriate object created from your class
hierarchy
- Store the above created object in a data structure of your
choice… (hint: think about using an a
ay…. But it´s your call...)
- When the end of the input file is reached write the entire
collection of ticket objects to an output file.

- The contents of your input file should be:

ga;Ba
;Young;11;Left;none;none
;Charles;Xavier;13;none;12;100
;Deborah;Walker;16;none;4;14
ga;Edwin;Viceroy;17;Center;none;none
ga;Francine;Utley;12;Right;none;none
;George;Talbot;64;none;13;56
;Ida;Smith;65;none;12;88
;John;Roosevelt;66;none;45;76
;Kate;Quake;47;none;23;15
ga;Tom;Mcdermott;16;Left;none;none

Where the field are in this order: ticket type ga for general
admission, r for reserved; first name; last name; age; ga section;
eserved seat row; reserved seat number

- The contents of your output file should be:

ga;Ba
;Young;11;Left;none;none;5
;Charles;Xavier;13;none;12;100;25
;Deborah;Walker;16;none;4;14;25
ga;Edwin;Viceroy;17;Center;none;none;10
ga;Francine;Utley;12;Right;none;none;5
;George;Talbot;64;none;13;56;25
;Ida;Smith;65;none;12;88;20
;John;Roosevelt;66;none;45;76;20
;Kate;Quake;47;none;23;15;25
ga;Tom;Mcdermott;16;Left;none;none;10

Where the field are in this order: ticket type ga for general
admission, r for reserved; first name; last name; age; ga section;
eserved seat row; reserved seat number; ticket price

- Create a ticket class containing all data and methods that should
e common to both GA and reserved tickets.
- Create both GA ticket and reserved ticket classes that are
derived from your ticket class

Your hierarchy should look ‘something like this’ as a possible
starting point:

Ticket
Data
Name
Age
Price
Methods
initialize
Write me to file


GA tickets
Everything that Ticket has plus:
Data
Section
Methods:
Calculate ticket price

Reserved tickets
Everything that Ticket has plus:
Data
Row
Seat number
Methods
Calculate ticket price


-The program must use our comment header and have a
comments section with your step by step algorithm outlined.
- The program must use inheritance with appropriate data
attributes and methods (initialize, setting the ticket price,
outputting the stored data) for each type of ticket.

Develop an algorithm

First you must make sure you understand the problem specified in
this requirements document. Your next task should be to build an
algorithm based on the requirements below, which is a series of
steps you need to execute to solve the problem at hand. Use the
information below to help build your algorithm. (This is ​one way​ to
fulfill the requirements)

1. Create a class that can be used to create objects that will
contain data common to all tickets
2. Create child classes, one that contains section for GA tickets
and another that contains row and seat number for reserved
tickets
3. Create a new A
ay to store objects in
4. Get ticket data from an input file
5. Calculate ticket price based on age
6. Store ticket data in an object
7. Store object in our a
ay
8. When the end of the input file is reached the program writes
all of the ticket data stored to an output file.

Build the program

Once you have built your algorithm, it's time to code up the
application. If you use RubyMine, begin by creating a new project
to store your programs. Then, add a new file to the project and
name it Final_Project_your_last_name.
(i.e.
Final_Project_Allen.
for me). Make sure you put the “.
” at the
end of the filename. Then, build a comment block at the top your
source file that contains your name, the assignment number, and
the filename. Below the comment header, place your algorithm in
as a series of comments, where each step is a comment. As you
write the program, implement the steps one-by-one. Add
comments when you find code whose purpose may not be
immediately obvious to a person looking at your code. Run your
program and make sure the results are co
ect.

Submit your work

To submit your program for grading, log into Blackboard and
navigate to the assignment. Click the assignment link and scroll
down to where you can attach files. Click the button to attach a
file, navigate to the project folder that contains
Final_Project_your_last_name.
, and select it. Finally, scroll to
the bottom of the page and click the Submit button. You can
submit your file as many times as you like, only the last
submission will be graded. Please keep in mind that I do not
accept late assignments so turn in whatever you have at the
deadline for partial credit.
Nov 22, 2021
SOLUTION.PDF

Get Answer To This Question

Submit New Assignment

Copy and Paste Your Assignment Here