Simulate a football stadium ticket system

Assignment Help Programming Languages
Reference no: EM131576938

Q1. Write a multithreaded application to simulate a football stadium ticket system. Four PurchaseType objects are linked to a TicketSystem object that allows for checking the number of available tickets and assigning them to a PurchaseType object. Only one PurchaseType object can buy tickets from the TicketSystem at a time. This may require synchronization between threads and the use of locks. There is a limit of four tickets per transaction.

These days there are a number of methods available for purchasing tickets. Tickets can be purchased over the counter in a retail outlet, over the phone with a customer service agent, online with a one-off transaction or online using a 1-click method, where all customer details and payment information are submitted to the system with a single mouse click. Your system should contain four instances of PurchaseType to reflect these purchase methods: retailPurchase, telephonePurchase, onlineOnce, onlineAccount. Each of the purchase methods has strengths and weaknesses. A retailPurchase takes 30-90 seconds to complete, a telephonePurchase takes 90-180 seconds to complete, an onlineOnce purchase takes 180-300 seconds to complete and an onlineAccount purchase takes 10-30 seconds to complete. However, a retailPurchase will cost the system €5 per transaction based on staff and premises costs. A telephonePurchase will cost the system €3.50 per transaction based on similar costs, an onlineOnce costs €0.50 per transaction due to server costs and an onlineAccount purchase costs €1 per transaction due to server costs, database maintenance and security costs.

Simulate a scenario where 80,000 seats are available for a championship game and each of the PurchaseType objects has a steady queue waiting to purchase tickets on a continuous basis. Simulate different customer requests (between 1 and 4 tickets). If less than the requested number of tickets are available, then the next highest amount of tickets should be allotted and an appropriate message displayed to the system output. To speed up the simulation use 10 milliseconds to represent 1 second. Each PurchaseType should have its own thread and take exclusive control of the TicketSystem for the duration of its transaction. Transaction times are not affected by the number of tickets being purchased but the times should fluctuate between the upper and lower ranges to simulate a more realistic system.

Messages should be displayed to the system output to indicate that the tickets have gone on sale, to display any warning messages about insufficient ticket numbers, and to indicate when a PurchaseType object can no longer buy tickets. Messages giving the total sales, total time and total cost to the system for each PurchaseType object should also be displayed at the end of the simulation.

Q2. Imagine that you have been contracted to write an application that tracks and manages files being moved from one storage location to another. Your application should be able to support the following actions: 1) Examine a designated file share. 2) Zip up existing directories. 3) Log the name of the zipped file, time it took to transfer the file and the size of file.

Given the above information, write a class that achieves the three goals above. Allow for cases where no path is specified at initialization, a path is specified, or a path and zip file name are specified. Write a test class that declares and initializes two instances of your file handling class, tests their methods appropriately and displays relevant information on screen. Your application should include appropriate use of inheritance and interfaces and allow for common file handling errors.

Reference no: EM131576938

Questions Cloud

Review the universal declaration of human rights : the Universal Declaration of Human Rights, the second page is a simplified history of how the document was written
Why are heaps useful in sorting : Define a heap and explain how trees can be turned into heaps.
List of the products sold or services performed : List of the products sold or services performed. Company web pages may be a source of additional info, but keep in mind the date of your annual report.
Define the properties of the quad trees : Define quad trees and explain how images can be represented using them. Describe how images can be rotated, scaled, and translated by manipulating.
Simulate a football stadium ticket system : Write a multithreaded application to simulate a football stadium ticket system. Four PurchaseType objects are linked to a TicketSystem object
Explain what is involved in a product costing system : Explain what is involved in a product costing system. Explain why Wilson-West Manufacturing needs to have a product costing system.
Problem related to the minimum spanning tree : Find a minimum spanning tree of the graph that connects the capital cities of the 50 states in the United States to each other where the weight of each edge.
Put yourself in a leadership role in a law enforcement : Describe how ethical issues in correctional and law enforcement agency operations can be impacted by teambuilding.
How many times was an odd number thrown : How many times was an odd number thrown? How many times did a number greater than or equal to 2 and less than or equal to 5 get thrown?

Reviews

Write a Review

Programming Languages Questions & Answers

  Discuss one e-business failure.

Did e-Business play any role in Enron's accounting problems? Explain.

  Program to perform a search of an employee list

Write a /bash/bin program to perform a search of an employee list.

  Write a lex program that converts a le to pig latin

Write a Lex program that converts a le to Pig Latin." Specially, assume the le is a sequence of words (groups of letters) separated by whitespace.

  Report on simple ms office operations include screen shot

Report on simple MS office operations include screen shot. Use your own choice of fonts and sizes. Set a top margin of 3 cm and bottom left and right 2 cm.

  Define switch-case function in javascript

I'm making a game where the user should combine the sound of a bird with the correct picture. In my webpage 20 different birds are represented. While pressing a button the game starts and a random birdsong will sound. Clicking the right bird will ..

  Definition of function quadratic receives double parameters

Write down definition of function named quadratic which receives 3 double parameters a , b , c . If value of a is 0 then function prints the message "no solution for a=0"

  Investigate two free and two fee-based options.

Include any personal experience you may have publishing a Web site. Investigate two free and two fee-based options.

  Create the css for a website

Create a file called lab1.html which contains the HTML of a blog page. Create another filelab1.css which is linked from lab1.html , and which contains all the style formatting of thedocument. These files must match the specification given below.

  Based on the kercher 2009 article how can management tools

q1. based on the kercher 2009 article how can management tools for microsoft windows server 2008 automate user account

  Write a computer program that prompts the user for a number

Write a computer program that prompts the user for a number, creates an array for that number of random integers, and then uses the sophisticated form of bubble sort to order the array.

  Create a program that keeps track

Create a program that keeps track of the following information input by the user: First Name, Last Name, Phone Number, and Age. Now - let's store this in a multidimensional array that will hold 10 of these contacts. So our multidimensional arra..

  Program to assign anonymous array of double value

Write c++ statements to permit the user to enter n, number of values to be processed; then assign an anonymous array of n double values, storing its address in doublPtr.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd