The store manager decided to giveaway Giants and Jets t-shirts to their customers since they were...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
The store manager decided to giveaway "Giants" and "Jets" t-shirts to their customers since they were shutting down the business. People supporting their team had to carry a sign that says whether they are "Giants" fan of "Jets". Store manager has no other employee to help him out and had all the t-shirts piled up in one single pile. So he came up with his own rule. The rule is simple: If customer in a queue is carrying sign that says "Giant" AND t-shirt on the pile is "Giants" t-shirt (or if customer in a queue is carrying sign that says "Jets" AND t-shirt on the pile is "Jets" t-shirt) then customer takes the t-shirt and leave the queue otherwise customer joins back queue at the end of the line. This continues until none of the queue customer want to take the top t-shirt or there are no more t-shirts left. You need to design you program to find out how many customer will end up getting no t-shirts. Example Input and output: Input(two arrays of String): Output(integer) : 0 compare new state compare new state compare new state compare new state compare new state Step by step process for sample input/output: Operation t-shirt Customer (front,.....,end) J, G, J, G J, G, J, G J, G, J, G G, J, G G, J, G G, J, G G, J, G J, G J, G J, G } compare new state G compare G new state empty J, G customers = [G,G,J,J] Queue Lab (front,.....,end) G, J, J, G J, J, G, G J, J, G, G J, G, G J, G, G G, G, J G, G, J G, J G, J J, G J, G G G empty t-shirts [J,G,J,G] Explanation J!= G send customer back to queue J == J customer take the t-shirt and leaves queue G != J send customer back to queue G == G customer take the t-shirt and leaves queue J!= G send customer back to queue J == J customer take the t-shirt and leaves queue G == G customer take the t-shirt and leaves queue MyQueue.java import java.util.LinkedList; import java.util.Queue; public class MyQueue { public int count CustomerWithoutTshirt (String[] customer, String[] tshirt) { Queue q = new LinkedList (); // write your logic here Put all your work in ONE Zip file and submit it in Canvas. Zip filename should be in format of FirstLast_Lab5.zip (ex. John Doe_Lab5.zip) Zip file should contain 4 files only: (1) MyQueue.java (2) Demo.java (3) Output.docx (screenshot of input and output) (4) Pseudo-code.docx (provide pseudo-code) The store manager decided to giveaway "Giants" and "Jets" t-shirts to their customers since they were shutting down the business. People supporting their team had to carry a sign that says whether they are "Giants" fan of "Jets". Store manager has no other employee to help him out and had all the t-shirts piled up in one single pile. So he came up with his own rule. The rule is simple: If customer in a queue is carrying sign that says "Giant" AND t-shirt on the pile is "Giants" t-shirt (or if customer in a queue is carrying sign that says "Jets" AND t-shirt on the pile is "Jets" t-shirt) then customer takes the t-shirt and leave the queue otherwise customer joins back queue at the end of the line. This continues until none of the queue customer want to take the top t-shirt or there are no more t-shirts left. You need to design you program to find out how many customer will end up getting no t-shirts. Example Input and output: Input(two arrays of String): Output(integer) : 0 compare new state compare new state compare new state compare new state compare new state Step by step process for sample input/output: Operation t-shirt Customer (front,.....,end) J, G, J, G J, G, J, G J, G, J, G G, J, G G, J, G G, J, G G, J, G J, G J, G J, G } compare new state G compare G new state empty J, G customers = [G,G,J,J] Queue Lab (front,.....,end) G, J, J, G J, J, G, G J, J, G, G J, G, G J, G, G G, G, J G, G, J G, J G, J J, G J, G G G empty t-shirts [J,G,J,G] Explanation J!= G send customer back to queue J == J customer take the t-shirt and leaves queue G != J send customer back to queue G == G customer take the t-shirt and leaves queue J!= G send customer back to queue J == J customer take the t-shirt and leaves queue G == G customer take the t-shirt and leaves queue MyQueue.java import java.util.LinkedList; import java.util.Queue; public class MyQueue { public int count CustomerWithoutTshirt (String[] customer, String[] tshirt) { Queue q = new LinkedList (); // write your logic here Put all your work in ONE Zip file and submit it in Canvas. Zip filename should be in format of FirstLast_Lab5.zip (ex. John Doe_Lab5.zip) Zip file should contain 4 files only: (1) MyQueue.java (2) Demo.java (3) Output.docx (screenshot of input and output) (4) Pseudo-code.docx (provide pseudo-code) The store manager decided to giveaway "Giants" and "Jets" t-shirts to their customers since they were shutting down the business. People supporting their team had to carry a sign that says whether they are "Giants" fan of "Jets". Store manager has no other employee to help him out and had all the t-shirts piled up in one single pile. So he came up with his own rule. The rule is simple: If customer in a queue is carrying sign that says "Giant" AND t-shirt on the pile is "Giants" t-shirt (or if customer in a queue is carrying sign that says "Jets" AND t-shirt on the pile is "Jets" t-shirt) then customer takes the t-shirt and leave the queue otherwise customer joins back queue at the end of the line. This continues until none of the queue customer want to take the top t-shirt or there are no more t-shirts left. You need to design you program to find out how many customer will end up getting no t-shirts. Example Input and output: Input(two arrays of String): Output(integer) : 0 compare new state compare new state compare new state compare new state compare new state Step by step process for sample input/output: Operation t-shirt Customer (front,.....,end) J, G, J, G J, G, J, G J, G, J, G G, J, G G, J, G G, J, G G, J, G J, G J, G J, G } compare new state G compare G new state empty J, G customers = [G,G,J,J] Queue Lab (front,.....,end) G, J, J, G J, J, G, G J, J, G, G J, G, G J, G, G G, G, J G, G, J G, J G, J J, G J, G G G empty t-shirts [J,G,J,G] Explanation J!= G send customer back to queue J == J customer take the t-shirt and leaves queue G != J send customer back to queue G == G customer take the t-shirt and leaves queue J!= G send customer back to queue J == J customer take the t-shirt and leaves queue G == G customer take the t-shirt and leaves queue MyQueue.java import java.util.LinkedList; import java.util.Queue; public class MyQueue { public int count CustomerWithoutTshirt (String[] customer, String[] tshirt) { Queue q = new LinkedList (); // write your logic here Put all your work in ONE Zip file and submit it in Canvas. Zip filename should be in format of FirstLast_Lab5.zip (ex. John Doe_Lab5.zip) Zip file should contain 4 files only: (1) MyQueue.java (2) Demo.java (3) Output.docx (screenshot of input and output) (4) Pseudo-code.docx (provide pseudo-code)
Expert Answer:
Related Book For
Management Accounting Information for Decision-Making and Strategy Execution
ISBN: 978-0137024971
6th Edition
Authors: Anthony A. Atkinson, Robert S. Kaplan, Ella Mae Matsumura, S. Mark Young
Posted Date:
Students also viewed these programming questions
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
Find the median and the mode for the following data: 65, 66, 66, 70, 71, 72, 72, 72, 78, 83, 85, 86, 87, 87, 88, 88, 92, 93, 95, 95, 99, 100, 102, 102, 102, 102, 102, 103, 104, 108, 111, 113, 118,...
-
Rank the microtidal forces on your own body, from greatest to least, produced by the a. Moon. b. Earth. c. Sun.
-
A circular hood is to be used over a piece of machinery. It is to be made from a circular piece of sheet metal 3.25 ft in radius. A hole 0.75 ft in radius and a sector of central angle 80.0 are to be...
-
The price of a non-dividend paying stock is \($19\) and the price of a three-month European call option on the stock with a strike price of \($20\) is \($1.\) The risk-free rate is 4% per annum. What...
-
Shown below are the job cost related accounts for the law firm of Jake, Ben, and Zack and their manufacturing equivalents: Law Firm Accounts Manufacturing Firm Accounts Supplies Raw Materials...
-
Assumethe following attributes :A, B, C, D, E, F and Gwiththe candidate key :Aand Cand the following functional dependencies : A--> B, F A, C-->D, E F --> G a. Draw the 1NF relational model and...
-
Direct materials inve ntory, March 1 $32,000 Direct materials inventory, March 31 27,000 Work-in-process inventory, March 1 10,000 Work-in-process inventory, March 31 Finished goods inventory, March...
-
s.t. Based on the following LP: max = 2x1 + 3x2 (4) 21-2224 2x1+x218 22 10 21,220 (a) [10 points] Solve the LP graphically. (b) [5 points] Write the point (2, 1) as a convex combination of the LP's...
-
All Shall Come to Pass Company was incorporated with an authorized capital of 40,000,000 equity shares of no par value. The Trial Balance extracted from the ledgers of the company as at 31st...
-
Determine the speed, wavelength, and frequency of light from a helium-neon laser as it travels through a diamond. The wavelength of the light from the laser is 632.8 nm in air and the index of...
-
what value does a environmental hotel provides to its customer?
-
An athlete training for an event does 5.28 x 10^4 J of work during a workout and gives off 2.97 x 10^5 J of heat. Consider the athlete to be like a heat engine. (a) Determine the magnitude of the...
-
Friction Loss in Pumping Oil to Pressurized Tank. An oil having a density of 833 kg/m' and a viscosity of 3.3 x 10-3 Pa s is pumped from an open tank to a pressurized tank held at 345 kPa gage. The...
-
Which of the following statements is false? a. Capital leases are not commonly reported in a Capital Projects Fund. b. A governmental entity may report a Capital Project Fund in one year but not the...
-
Are materials always a flexible resource? Why?
-
What are some special considerations in the design of cost accounting systems for service organizations?
-
You are a senior manager responsible for overall company operations in a large courier company. Your company has 106 regional offices (terminals) scattered around the country and a main office (hub)...
-
Suppose that the supply function for lamb in Australia is \(Q=149+8 p-9 p\), where \(Q\) is the quantity in millions of \(\mathrm{kg}\) of lamb per year, and \(p\) and \(p_{s}\) are the prices of...
-
Duffy-Deno (2003) estimated the demand functions for broadband service are \(Q_{s}=15.6 p^{-0.563}\) for small firms and \(Q_{l}=16.0 p^{-0.296}\) for larger ones, where price is in cents per...
-
If the supply curve for fertilizer in Jordan is \(Q_{j}=-2+4 p\) and the supply curve for fertilizer in the rest of the world is \(Q_{\text {row }}=25+8 p\), what is the world supply curve?
Study smarter with the SolutionInn App