Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Programming Language Expert

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.

Programming Language, Programming

  • Category:- Programming Language
  • Reference No.:- M92385653
  • Price:- $30

Priced at Now at $30, Verified Solution

Have any Question?


Related Questions in Programming Language

Structs and enumsoverviewin this task you will create a

Structs and Enums Overview In this task you will create a knight database to help Camelot keep track of all of their knights. Instructions Lets get started. 1. What the topic 5 videos, these will guide you through buildi ...

Assignment - horse race meetingthe assignment will assess

Assignment - Horse Race Meeting The Assignment will assess competencies for ICTPRG524 Develop high level object-oriented class specifications. Summary The assignment is to design the classes that are necessary for the ad ...

1 write a function named check that has three parameters

1. Write a function named check () that has three parameters. The first parameter should accept an integer number, andthe second and third parameters should accept a double-precision number. The function body should just ...

Assignment - proposal literature review research method1

Assignment - Proposal, Literature Review, Research Method 1. Abstract - Summary of the knowledge gap: problems of the existing research - Aim of the research, summary of what this project is to achieve - Summary of the a ...

Question - create a microsoft word macro using vba visual

Question - Create a Microsoft Word macro using VBA (Visual Basic for Applications). Name the macro "highlight." The macro should highlight every third line of text in a document. (Imagine creating highlighting that will ...

Assignmentquestion onegiving the following code snippet

Assignment Question One Giving the following code snippet. What kind of errors you will get and how can you correct it. A. public class HelloJava { public static void main(String args[]) { int x=10; int y=2; System.out.p ...

Assignment - horse race meetingthe assignment will assess

Assignment - Horse Race Meeting The Assignment will assess competencies for ICTPRG524 Develop high level object-oriented class specifications. Summary The assignment is to design the classes that are necessary for the ad ...

Task arrays and structsoverviewin this task you will

Task: Arrays and Structs Overview In this task you will continue to work on the knight database to help Camelot keep track of all of their knights. We can now add a kingdom struct to help work with and manage all of the ...

Extend the adworks applicationi add dialogs to allow the

Extend the AdWorks application I. Add Dialogs to allow the user to Add, Edit, Read and Delete a Customer and refresh the view accordingly. 1. The user should be able to select a specific customer from the DataGrid and cl ...

Overviewthis tasks provides you an opportunity to get

Overview This tasks provides you an opportunity to get feedback on your Learning Summary Report. The Learning Summary Report outlines how the work you have completed demonstrates that you have met all of the unit's learn ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As