Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
20 views

Assignment 1 - Ticket Management System

Uploaded by

thariyarox1512
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views

Assignment 1 - Ticket Management System

Uploaded by

thariyarox1512
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 26

Assignment 1 - Ticket Management System

Introduction
Welcome to the first of your assignments for COMP90041 - Programming and Software
Development!

For this project, we will be implementing a ticket management system.

This program will be built in two parts (Assignment 1 and Assignment 2), with Assignment 1 building
the groundwork for the final system in Assignment 2.

In Assignment 1, we will build an initial system implementation with what we've learned about Object
Oriented Programming so far. In Assignment 2, we will extend the system with additional features,
and also refactor existing features with newly learned Object Oriented Programming concepts, to
make our code more elegant.

This project intends to give you practice with basic Java concepts and basics of Object-Oriented
Software Development and Design and some experience in developing software as requirements for
a system evolve. It also provides some good experience in building a system part by part from
scratch, until an overall system is complete.
Preamble: "The Specifications"
The slides from this lesson module for the assignment act as "the specifications" for the system we
are about to build.

"The specifications" in real-life software development is the document that details the features that
should be implemented in any particular project. They are the features and requirements that you,
the Software Developer, and the client have agreed should be implemented in the system.

As such, you should read these specifications carefully and ensure that your program implements the
requirements of the specification correctly.

Tests will be run on your program to check that you have implemented these specifications correctly.

Note that for this project, we will provide some visible tests that you can run to check that the basic
functionality of your system is correct. However, there will also be hidden (i.e., invisible) tests that we
will run when assessing the correctness of your code. So once your program passes the basic tests,
we strongly recommend that you perform further tests yourself, to ensure that the required features
have been implemented correctly.

Students can assume that test cases only contains output that are explicitly part of specifications. The test
cases, visible or hidden, does not produce any output that is not mentioned in the specifications explicitly.
Please note that the specifications will give you warnings and important notes where we expect special input
handling. You should observe those and implement those accordingly as they will be tested while marking your
program.
Preamble: Object Oriented Design
Since this subject uses an object-oriented language, object-oriented design is one aspect in which we
will assess your code.

When creating classes, make careful consideration of which instance variables and methods should
go in which classes, and ensure you are properly encapsulating your code, by using the appropriate
visibility modifiers.

Some classes have been provided to you in the starter code, and those classes
(TicketManagementEngine, Venue) must be used when developing your program. You may wish to
consider adding additional classes to make your code more modular, however.

A warning for those that have previous experience programming in other programming languages (like C or
Python) that follow a procedural programming paradigm: Be careful to develop your program using object
oriented principles, as programming and structuring your code in a way that is not object-oriented is an easy
way to lose marks for structure in the assignments.
Preamble: Structure and Style
We will also be assessing your code for good structure and style.

Use methods when appropriate to simplify your code, and avoid duplicate code.

Use correct Java naming conventions for class names, variable names, and method names and
put them in a well organised way in your code i.e. it should be readable as well.

Make sure the names you choose are meaningful, to improve the readability of your code.

We will provide a marking scheme to help guide you in the development of your program. Keep an eye out for
it, for when it is released later!
Academic Honesty �
All assessment items (assignments, test and exam) must be your own, individual, original work.
Any code that is submitted for assessment will be automatically compared against other
students' code and other code sources using sophisticated similarity checking software.
Cases of potential copying or submitting code that is not your own may lead to a formal
academic misconduct hearing.
Potential penalties can include getting zero for the project, failing the subject, or even expulsion
from the university in extreme cases.
For further information, please see the university's Academic Honesty and Plagiarism website,
or ask your lecturer.
Ticket Management System
Welcome to the revised version of Taylor Swift’s Eras Tour. If you recently missed the Taylor Swift
concert, you could still book your seats here and grab some concert tickets. Checkout what you need
to do to build your own ticket management system and schedule the concert at different times and
book some tickets.

To start with the program we will look at below things one by one -

Main Menu
Show timings
Ticket Costs
Seat Layout
Booking the seat for yourself.

In this version, we will only be setting up the layout of the concert venue and book seats for yourself. In
next versions we will enhance it further to resemble a real world ticket management system where
you can buy tickets for your friends as well.

To start writing the program, there are certain files and empty methods that are provided to you. You
should be able to run your Program by compiling it and running from the EdStem platform.

Note: Your program expects some command line parameters that we will discuss in Seat Layout section.
These command line parameters are set in EdStem platform and will be available to your program when you
hit the submit/mark button. But if you are trying this in an IDE, you may have to set the command line
parameters yourself using command line or IDE features.
Main Menu

Main Menu
To start with the Ticket Management System, you will need to print the display message. This part of
the code is already provided to you. You must not remove this from the files.

Welcome to a revised version of Taylor Swift's Eras tour.

_____ _____ ________ ___ _____


| ___| |_ _| |_ _| \/ |/ ___|
| |__ _ __ __ _ ___ | | ___ _ _ _ __ | | | . . |\ `--.
| __| '__/ _` / __| | |/ _ \| | | | '__| | | | |\/| | `--. \
| |__| | | (_| \__ \ | | (_) | |_| | | | | | | | |/\__/ /
\____/_| \__,_|___/ \_/\___/ \__,_|_| \_/ \_| |_/\____/

We will start by printing some menu options for the user to select from. The output looks like this -

Select an option to get started!


Press 1 to look at the show timings
Press 2 to look at the ticket costs
Press 3 to view the layout of the concert
Press 4 to book a seat
Press 5 to exit
>

You should then take a user input and perform one of the actions out of the 5 given.

Exit Option
In case the user selects option 5, you must gracefully quit the program and print a goodbye message.
Look at the complete output below.

Note: The text in bold represents user input here. You don't need to make the console inputs bold in your
code.

Welcome to a revised version of Taylor Swift's Eras tour.

_____ _____ ________ ___ _____


| ___| |_ _| |_ _| \/ |/ ___|
| |__ _ __ __ _ ___ | | ___ _ _ _ __ | | | . . |\ `--.
| __| '__/ _` / __| | |/ _ \| | | | '__| | | | |\/| | `--. \
| |__| | | (_| \__ \ | | (_) | |_| | | | | | | | |/\__/ /
\____/_| \__,_|___/ \_/\___/ \__,_|_| \_/ \_| |_/\____/
Select an option to get started!
Press 1 to look at the show timings
Press 2 to look at the ticket costs
Press 3 to view the layout of the concert
Press 4 to book a seat
Press 5 to exit
> 5
Goodbye from the Ticket Management System! See you next time!

Invalid Command
In case someone provides an invalid input like 7 or 9, you should be able to print “Invalid Input” and
prompt the user again with the menu to select a valid input again. Sample output

Select an option to get started!


Press 1 to look at the show timings
Press 2 to look at the ticket costs
Press 3 to view the layout of the concert
Press 4 to book a seat
Press 5 to exit
> 7
Invalid Input.
Select an option to get started!
Press 1 to look at the show timings
Press 2 to look at the ticket costs
Press 3 to view the layout of the concert
Press 4 to book a seat
Press 5 to exit
>

Note: The program only expects an integer value for the main menu. You need not handle string or double
values as input at this point of time.

Show timings
If the user selects option 1, you must show the below details to the user.

Select an option to get started!


Press 1 to look at the show timings
Press 2 to look at the ticket costs
Press 3 to view the layout of the concert
Press 4 to book a seat
Press 5 to exit
> 1
Show Timings
----------------------------------------------------------------------------------------
Date Artist Name Timing Venue Name Total Seats
----------------------------------------------------------------------------------------
2024-05-01 Taylor Swift 1700 - 2100 Melbourne Cricket Ground 100
2024-05-02 Taylor Swift 1700 - 2100 Melbourne Cricket Ground 100
2024-05-03 Taylor Swift 1700 - 2100 Melbourne Cricket Ground 100
----------------------------------------------------------------------------------------
Select an option to get started!
Press 1 to look at the show timings
Press 2 to look at the ticket costs
Press 3 to view the layout of the concert
Press 4 to book a seat
Press 5 to exit
>

Use the formatted input with settings "%-15s%-15s%-15s%-30s%10s\n" to print the output in a nice
format. This is provided to you in the code.

Ticket Costs
Your seat layout is divided into three sections - Left, Middle, Right. This is explained in detail in the
next section. Your ticket cost varies as per the sections. When the user selects the input 2 from the
main menu, you must print the below output -

Select an option to get started!


Press 1 to look at the show timings
Press 2 to look at the ticket costs
Press 3 to view the layout of the concert
Press 4 to book a seat
Press 5 to exit
> 2
Seat Costs
--------------------
Left Zone: AUD 200
Right Zone: AUD 200
Middle Zone: AUD 500
--------------------
Select an option to get started!
Press 1 to look at the show timings
Press 2 to look at the ticket costs
Press 3 to view the layout of the concert
Press 4 to book a seat
Press 5 to exit
>
Seats Layout
The layout for the seats is simple. There are three sections for the seats - Left, Middle, Right.

[____ _____ ____]


[____ _____ ____]
[____ _____ ____]
[____ _____ ____]
[____ _____ ____]

Symbols & Meanings

[ - start of the seating row


] - end of the seating row
_ - represents a seat
" " - an empty space represents an aisle
X - represents a selected seat

Inputs

Your program must take command line inputs in below order.

Rows - total number of rows for the seats. In this example it is 5.


Left column - how many seats present in the left column. In this case it is 4.
Middle column - how many seats are present in the middle column. In this example it is 5.
Right column - how many seats present in the right column. In this example it is 4.

This means when you compile your program and run it, the command on terminal should look like
this

javac TicketManagementEngine.java
java TicketManagementEngine 5 4 5 4

Note: You must not hard code this in your program. We may provide an input of 5 or 7 as well to check if your
program works correctly.

In case there are insufficient inputs (missing input) or if any of the input is 0 or negative, then exit the
program by printing the error message -

javac TicketManagementEngine.java
java TicketManagementEngine 5 4 5
Invalid Inputs to set layout. Exiting the program now.
These command line parameters are set in EdStem platform and will be available to your program when you
hit the submit/mark button. But if you are trying this in an IDE, you may have to set the command line
parameters yourself using command line or IDE features.

When the user selects option 3 from the main menu you must print the seat layout as per the seat
settings provided as an input in the command line arguments.

To create the layout remember the following points:

You will print as many rows as provided in the command line arguments.
To print the seats in columnar format, you must start with a [ character. This marks the start of
the row and not the seat.
Then you will print the number of seats using an underscore “_” for the left side as per the input
from the command line arguments.
After the left side of the seats are printed a space should be provided to mark the aisle.
Then you should print the seats in the middle section as per the input, followed by another
space to mark the aisle.
Lastly, you should print the seats in the right column, followed by a ] character to mark the end
of seating row.

Sample output for the above -

Welcome to a revised version of Taylor Swift's Eras tour.

_____ _____ ________ ___ _____


| ___| |_ _| |_ _| \/ |/ ___|
| |__ _ __ __ _ ___ | | ___ _ _ _ __ | | | . . |\ `--.
| __| '__/ _` / __| | |/ _ \| | | | '__| | | | |\/| | `--. \
| |__| | | (_| \__ \ | | (_) | |_| | | | | | | | |/\__/ /
\____/_| \__,_|___/ \_/\___/ \__,_|_| \_/ \_| |_/\____/

Select an option to get started!


Press 1 to look at the show timings
Press 2 to look at the ticket costs
Press 3 to view the layout of the concert
Press 4 to book a seat
Press 5 to exit
> 3
[____ _____ ____]
[____ _____ ____]
[____ _____ ____]
[____ _____ ____]
[____ _____ ____]
Select an option to get started!
Press 1 to look at the show timings
Press 2 to look at the ticket costs
Press 3 to view the layout of the concert
Press 4 to book a seat
Press 5 to exit
>
Book Tickets
Once the user selects option 4 to book the tickets we must allow them to select a seat. To select a seat
you may need to move around the layout and mark your seat. A selected seat is marked by X. By
default the leftmost seat is pre-selected. You can then prompt the user with a menu to move around
the seating selection. Look at the sample output below -

Select an option to get started!


Press 1 to look at the show timings
Press 2 to look at the ticket costs
Press 3 to view the layout of the concert
Press 4 to book a seat
Press 5 to exit
> 4
Continue to the seat selection!
You can select the seat that are empty and marked by _
[X___ _____ ____]
[____ _____ ____]
[____ _____ ____]
[____ _____ ____]
[____ _____ ____]
Press W to move up.
Press A to move left.
Press S to move down.
Press D to move right.
Press Q to exit
>

Tip: in this case you will expect a String input - w/a/s/d/q. This can be upper or lower case. You must
handle the input accordingly.

Invalid Input
If the user enters any other string like “hi”, you must prompt invalid input. Sample output below -

Continue to the seat selection!


You can select the seat that are empty and marked by _
[X___ _____ ____]
[____ _____ ____]
[____ _____ ____]
[____ _____ ____]
[____ _____ ____]
Press W to move up.
Press A to move left.
Press S to move down.
Press D to move right.
Press Q to exit
> hi
Invalid input.
[X___ _____ ____]
[____ _____ ____]
[____ _____ ____]
[____ _____ ____]
[____ _____ ____]
Press W to move up.
Press A to move left.
Press S to move down.
Press D to move right.
Press Q to exit
>

Movement - Right/Left/Top/Bottom
In case user wants to move to any direction, the marked seat will be changed to appropriate position.
When the user selects option 4 for the first time, by default the top left seat will be selected.

Move Right

Select an option to get started!


Press 1 to look at the show timings
Press 2 to look at the ticket costs
Press 3 to view the layout of the concert
Press 4 to book a seat
Press 5 to exit
> 4
Continue to the seat selection!
You can select the seat that are empty and marked by _
[X___ _____ ____]
[____ _____ ____]
[____ _____ ____]
[____ _____ ____]
[____ _____ ____]
Press W to move up.
Press A to move left.
Press S to move down.
Press D to move right.
Press Q to exit
> d
[_X__ _____ ____]
[____ _____ ____]
[____ _____ ____]
[____ _____ ____]
[____ _____ ____]
Press W to move up.
Press A to move left.
Press S to move down.
Press D to move right.
Press Q to exit
>
Move Left

[_X__ _____ ____]


[____ _____ ____]
[____ _____ ____]
[____ _____ ____]
[____ _____ ____]
Press W to move up.
Press A to move left.
Press S to move down.
Press D to move right.
Press Q to exit
> a
[X___ _____ ____]
[____ _____ ____]
[____ _____ ____]
[____ _____ ____]
[____ _____ ____]
Press W to move up.
Press A to move left.
Press S to move down.
Press D to move right.
Press Q to exit
>

Move Down

[X___ _____ ____]


[____ _____ ____]
[____ _____ ____]
[____ _____ ____]
[____ _____ ____]
Press W to move up.
Press A to move left.
Press S to move down.
Press D to move right.
Press Q to exit
> s
[____ _____ ____]
[X___ _____ ____]
[____ _____ ____]
[____ _____ ____]
[____ _____ ____]
Press W to move up.
Press A to move left.
Press S to move down.
Press D to move right.
Press Q to exit
>

Move up

[____ _____ ____]


[X___ _____ ____]
[____ _____ ____]
[____ _____ ____]
[____ _____ ____]
Press W to move up.
Press A to move left.
Press S to move down.
Press D to move right.
Press Q to exit
> w
[X___ _____ ____]
[____ _____ ____]
[____ _____ ____]
[____ _____ ____]
[____ _____ ____]
Press W to move up.
Press A to move left.
Press S to move down.
Press D to move right.
Press Q to exit
>

Invalid Moves
If you are already at the left most seat/ right most seat/ topmost seat or bottom most seat and you
want to move left/right/ up/down respectively, that would be an invalid move and you should print a
warning message that says “Invalid move”. Look at the sample output below -

[X___ _____ ____]


[____ _____ ____]
[____ _____ ____]
[____ _____ ____]
[____ _____ ____]
Press W to move up.
Press A to move left.
Press S to move down.
Press D to move right.
Press Q to exit
> w
Invalid move.
[X___ _____ ____]
[____ _____ ____]
[____ _____ ____]
[____ _____ ____]
[____ _____ ____]
Press W to move up.
Press A to move left.
Press S to move down.
Press D to move right.
Press Q to exit
>
Special Moves
Every time you move right/left/top/bottom you move the position of “X” by 1. However notice if you
are near the aisle seat, you must move “X” appropriately so that you don’t end up being at aisle. You
should move on to the next available seat.This is valid for both moving from left to middle or middle
to right aisle and going back from right to middle or middle to left aisle. For example -

Correct Output -

[___X _____ ____]


[____ _____ ____]
[____ _____ ____]
[____ _____ ____]
[____ _____ ____]
Press W to move up.
Press A to move left.
Press S to move down.
Press D to move right.
Press Q to exit
> d
[____ X____ ____]
[____ _____ ____]
[____ _____ ____]
[____ _____ ____]
[____ _____ ____]
Press W to move up.
Press A to move left.
Press S to move down.
Press D to move right.
Press Q to exit
>

Incorrect Output : You cannot book an empty space on the aisle.

[___X _____ ____]


[____ _____ ____]
[____ _____ ____]
[____ _____ ____]
[____ _____ ____]
Press W to move up.
Press A to move left.
Press S to move down.
Press D to move right.
Press Q to exit
> d
[____X_____ ____]
[____ _____ ____]
[____ _____ ____]
[____ _____ ____]
[____ _____ ____]
Press W to move up.
Press A to move left.
Press S to move down.
Press D to move right.
Press Q to exit
>

Exiting from Seat Selection


If the user selects the option Q then you should save the seat selection and exit from the seat
selection menu.

[____ X____ ____]


[____ _____ ____]
[____ _____ ____]
[____ _____ ____]
[____ _____ ____]
Press W to move up.
Press A to move left.
Press S to move down.
Press D to move right.
Press Q to exit
> Q
Your seat selection is saved
Select an option to get started!
Press 1 to look at the show timings
Press 2 to look at the ticket costs
Press 3 to view the layout of the concert
Press 4 to book a seat
Press 5 to exit
>

After a seat selection is saved, if the user wants to view the layout again, the selected seat should be
marked in this case.

[____ X____ ____]


[____ _____ ____]
[____ _____ ____]
[____ _____ ____]
[____ _____ ____]
Press W to move up.
Press A to move left.
Press S to move down.
Press D to move right.
Press Q to exit
> Q
Your seat selection is saved.
Select an option to get started!
Press 1 to look at the show timings
Press 2 to look at the ticket costs
Press 3 to view the layout of the concert
Press 4 to book a seat
Press 5 to exit
> 3
[____ X____ ____]
[____ _____ ____]
[____ _____ ____]
[____ _____ ____]
[____ _____ ____]
Select an option to get started!
Press 1 to look at the show timings
Press 2 to look at the ticket costs
Press 3 to view the layout of the concert
Press 4 to book a seat
Press 5 to exit
>

That would be all for now. We will come back with more features for your friends to book
tickets in the next version. Happy Coding Everyone!
Ticket Management System
Some starter code has been provided for you. Write the code to implement your program there �

We also provided some tests for your code, which will run automatically every time you hit "Mark".
You can run these tests as many times as you would like until the submission deadline.

Submission will close on 08 April 2024 0900 AEDT.

Happy coding!
Marking Scheme �

Warning! You must make sure that your code runs on edstem. If your code does not compile on
edstem, 0 marks will be given.

COMP90041 Assignment 1: Marking Scheme


Student: [Student ID goes here]

Program Presentation
Including: layout and style, readability, adherence to coding expectations and conventions, general
care and appearance. The full marks for this section of marking is 6.

Marks awarded

Some subset of the following lines will be selected by the marker.

Gain 0.5 marks for any of the issues listed below.

All choices of variable names were meaningful;


All choices of method names were meaningful;
variable and method names follow Java convention (camelCase);
constant names follow Java convention (UPPER_SNAKE_CASE);
class names follow Java convention (UpperCamelCase);
comments were sufficient and meaningful;
consistent bracket placement;
indentation was consistent;
whitespace was used to separate logical blocks of code;
authorship statement (name, university email, student number) provided;
all magic numbers (essentially numbers other than 0 or 1) were assigned to constants;
overall care and presentation, such as particularly good comments, up to +1.0 mark;

Deductions

stylistic issue, if major -1.0 mark per issue; if minor, -0.5 mark per issue

Total marks for this section (no more than 6): /6

Other comments from marker: [Comments go here]


Structure and Approach
Including: decomposition into methods, declaration of instance variables at the appropriate locations,
choice of parameters to methods.

The full marks for this section of marking is 9.

Marks awarded

Some subset of the following lines will be selected by the marker.

Gain 1 mark for any issue listed below.

Good use of methods;


No methods were too long or too complex;
code was not duplicated (tasks to be done in more than one place are in method);
simple algorithmic approach to solving the problem;
clearly structured code;
no more than 3 static methods (including main) were used -- most should be bound to
objects;
no more than 4 static variables were used -- most should be non-static (" final static "
constants are not variables);
'appropriate use of encapsulation; limiting scope of variables to private except where
reasonable justification is given.
Code File Organisation - instance variables, constructors, methods are added in a class in right
order.

Deductions

structural issue, if major -2.0 marks per issue, otherwise -1.0 mark per issue.

Total marks for this section: / 9

Other comments from marker: [Comments go here]

Program Execution
Including: compilation, execution on test data, output presentation and readability.

Programs that do not compile in the test environment will lose all marks in this section. Be sure to
verify your submission and check the output before you say "finished" to yourself.

The full marks for this section of marking is 15.

Marks awarded
Gain 1 marks per test case passed;

Gain 0.5 marks for tests with slightly different output (e.g., small changes in whitespace; if the marker
says the difference is not slight, that is final. This should not occur if the available test cases are all
checked.);

Gain 0 for other failed tests

Visible tests passed: / 9

Hidden tests passed: / 6

Total tests passed: / 15

Total marks for this section: / 15

Total Marks for the Assignment: / 30

Overall comments from marker: [Comments go here]

Assignment Marker: [Assignment marker name goes here]

If you have any questions regarding your mark, please contact the lecturers
Assessment
This project is worth 15% of the total marks for the subject. Your Java program will be assessed based
on the correctness of the output as well as the quality of code implementation.

Automatic tests will be conducted on your program by compiling, running, and comparing your
outputs for several test cases with generated expected outputs. The automatic test will deem your
output wrong if your output does not match the expected output, even if the difference is just having
extra space or missing a colon. Therefore, it is crucial that your output follows exactly the same
format shown in the provided examples.

Passing the tests we provide here on edstem does not mean you will score full marks. Each submission will
further be subject to hidden tests as well as manual inspection by our teaching team.

The syntax import is available for you to use standard java packages. However, DO NOT use the
package syntax to customize your source files. The automatic test system may not deal with
customized packages. If you are using Netbeans, IntelliJ or Eclipse for your development, be aware
that the project name may automatically be used as the package name. You must remove lines like:

package Assignment1;

at the beginning of the source files when you copy them to edstem. Otherwise, the automatic tests
may fail and tell you so.
Submission
Your submission should have at least two Java source code files. You must name them
TicketManagementEngine.java, Venue.java.

Starter code has been provided to you here on the edstem platform, but you are welcome to develop
the project outside of the edstem environment, using your own IDEs.

Submission is made via edstem, however, and will be whatever code is saved on the Code
Challenge when the project deadline closes.

Your code MUST compile and run here on edstem. If your code does not compile we cannot mark it and you
risk getting 0 marks.

“I can’t get my code to work on edstem but it worked on my local machine” is not an acceptable excuse
for late submissions. In addition, submissions via email will not be accepted.

Be sure to copy your code into your Code Challenge workspace well before the deadline to avoid
being locked out of submissions last minute.

Only the last version of your code before the submission deadline will be graded. It is highly
recommended that you update your code on edstem frequently and well before the submission
deadline. Last-minute "connection errors" are not a valid excuse.

In case you need an extension due to valid reasons, please fill up this form and we will follow up
with you. Ensure you have a valid reason and proper documentation with you before seeking
extension. If you seek an extension beyond 10 days, contact STOP 1. See more here.
Additional Help: Quick Review of EdStem and Assignment
We have added a short video to help you with EdStem. This video shows how you can create new
files in EdStem, run or mark your submission and how to move your code from IDE to EdStem.

An error occurred.

Try watching this video on www.youtube.com, or enable JavaScript if it is


disabled in your browser.

You might also like