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

  Write a haskell program to calculates a balanced partition

Write a program in Haskell which calculates a balanced partition of N items where each item has a value between 0 and K such that the difference b/w the sum of the values of first partition,

  Create an application to run in the amazon ec2 service

In this project you will create an application to run in the Amazon EC2 service and you will also create a client that can run on local machine and access your application.

  Explain the process to develop a web page locally

Explain the process to develop a Web page locally

  Write functions

These 14 questions covers java class, Array, link list , generic class.

  Programming assignment

If the user wants to read the input from a file, then the output will also go into a different file . If the user wants to read the input interactively, then the output will go to the screen .

  Write a prolog program using swi proglog

Write a Prolog program using swi proglog

  Create a custom application using eclipse

Create a custom Application Using Eclipse Android Development

  Create a application using the mvc architecture

create a application using the MVC architecture. No scripting elements are allowed in JSP pages.

  Develops bespoke solutions for the rubber industry

Develops bespoke solutions for the rubber industry

  Design a program that models the worms behavior

Design a program that models the worm's behavior.

  Writing a class

Build a class for a type called Fraction

  Design a program that assigns seats on an airplane

Write a program that allows an instructor to keep a grade book and also design and implement a program that assigns seats on an airplane.

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