Questions
A priority queue is a special queue that adjusts the location of items based on some...

  1. A priority queue is a special queue that adjusts the location of items based on some priority value. When inserted, a new value is placed in the queue ahead of every other item that has a lower priority than it. This gives us a queue that removes items from the front removing highest priority first, and from items with similar priority the ones that were inserted first. For example, if we inserted the following items with the priority {A, 1}, {B,2}, {C,2}, {D,3}, {E,1} where the lower number is a lower priority, our queue will have the items from front to back: D,B,C,A,E. Using the partial code below, you are to implement the Enqueue method so that the new node is inserted into the appropriate place in the queue based on the priority. (Assume that a higher number is higher priority, for example 0 is lowest and 10 is highest)

class Node<V,P>

{

      public V value;

      public P priority;

      public Node<V,P> next;

     

      Node(V value, P priority)

      {

           this.value = value;

           this.priority = priority;

      }

}

class PriorityQueue<V,P>

{

      private Node<V,P> head;

      private Node<V,P> tail;

     

      ...

      public void Enqueue(V value, P priority)

      {

In: Computer Science

16. A loaded elevator is raised by a motor that is rated at 3.65 x 104W....

16. A loaded elevator is raised by a motor that is rated at 3.65 x 104W. The motor raises the elevator at a steady speed of 3.10 m/s up. What is the mass of the elevator and its occupants?

In: Physics

A gas is contained in a vertical piston–cylinder assembly by a piston with a face area...

A gas is contained in a vertical piston–cylinder assembly by a piston with a face area of 40 in2 and weight of 100 lbf. The atmosphere exerts a pressure of 14.7 lbf/in2 on top of the piston. A paddle wheel transfers 3 Btu of energy to the gas during a process in which the elevation of the piston increases slowly by 2 ft. The piston and cylinder are poor thermal conductors, and friction between the piston and cylinder can be neglected. Determine the work done by the gas on the piston, in Btu, and the change in internal energy of the gas, in Btu.

A force balance on the piston shows that, for this process, the gas pressure is:


constant and negative
constant and positive
increasing and positive
decreasing and positive

In: Physics

A 1325 kg elevator starts from rest and moves upwards for 4 seconds with a constant...

A 1325 kg elevator starts from rest and moves upwards for 4 seconds with a constant acceleration until it reaches a speed of 2.1 m/s. After 4 seconds, the speed of the elevator remains constant. A) What is the average power of the elevator motor during the first 4 seconds? B) What is the average power of the elevator when t=9 seconds?

In: Physics

Problem 20-4A (Part Level Submission) Last year (2016), Richter Condos installed a mechanized elevator for its...

Problem 20-4A (Part Level Submission)

Last year (2016), Richter Condos installed a mechanized elevator for its tenants. The owner of the company, Ron Richter, recently returned from an industry equipment exhibition where he watched a computerized elevator demonstrated. He was impressed with the elevator's speed, comfort of ride, and cost efficiency. Upon returning from the exhibition, he asked his purchasing agent to collect price and operating cost data on the new elevator. In addition, he asked the company’s accountant to provide him with cost data on the company’s elevator. This information is presented below.

Old Elevator New Elevator Purchase price $104,500 $161,000

Estimated salvage value 0 0

Estimated useful life 5 years 4 years

Depreciation method Straight-line Straight-line

Annual operating costs other than depreciation:

Variable $35,600 $11,000

Fixed 23,200 9,000

Annual revenues are $239,000, and selling and administrative expenses are $29,000, regardless of which elevator is used. If the old elevator is replaced now, at the beginning of 2017, Richter Condos will be able to sell it for $24,700.

Determine any gain or loss if the old elevator is replaced.

In: Accounting

We have a cylinder and piston similar to the one in the figure. The diameter of...

We have a cylinder and piston similar to the one in the figure. The diameter of the piston is 3.50 cm. The distance from the bottom of the cylinder to the piston is 12.6 cm. The cylinder is filled with an ideal diatomic gas at room temperature (23.8∘C23.8∘C) and room pressure (1.00 atm).

(a)

If we push down on the piston with a force equal to 119 lb, how far can we move the piston? Consider the compression to be adiabatic, and neglect the flow of heat to the surroundings. Also neglect the weight of the piston. Caution: remember that atmospheric pressure also pushes down on the piston. The total downward force is 119 lb plus the force of atmospheric pressure. Be sure to give the distance the piston moves, not just the final height of the piston.

(b)

Repeat for an ideal monatomic gas.

In: Physics

A card game at a casino costs $10 to play. One card is selected at random...

A card game at a casino costs $10 to play. One card is selected at random from a standard deck. If a heart is selected the player wins $19. If a spade is selected, the player wins $14. If a club or diamond is selected, the player wins nothing. What is the expected value of this game to the player? Round your answer to the nearest cent. Do not include the $ sign in your answer.

A homeowner purchases an insurance policy against fire for $140 on her house valued at $150,000. The insurance company estimates the probability the house will burn down is 0.0002. What is the expected value of the policy to the homeowner? Round your answer to the nearest cent.

In: Statistics and Probability

Problem 20-4A (Part Level Submission) Last year (2016), Richter Condos installed a mechanized elevator for its...

Problem 20-4A (Part Level Submission) Last year (2016), Richter Condos installed a mechanized elevator for its tenants. The owner of the company, Ron Richter, recently returned from an industry equipment exhibition where he watched a computerized elevator demonstrated. He was impressed with the elevator's speed, comfort of ride, and cost efficiency. Upon returning from the exhibition, he asked his purchasing agent to collect price and operating cost data on the new elevator. In addition, he asked the company’s accountant to provide him with cost data on the company’s elevator. This information is presented below. Old Elevator New Elevator Purchase price $98,500 $159,000 Estimated salvage value 0 0 Estimated useful life 5 years 4 years Depreciation method Straight-line Straight-line Annual operating costs other than depreciation: Variable $34,400 $11,000 Fixed 22,400 8,600 Annual revenues are $240,000, and selling and administrative expenses are $28,000, regardless of which elevator is used. If the old elevator is replaced now, at the beginning of 2017, Richter Condos will be able to sell it for $24,700. Collapse question part (a) Correct answer. Your answer is correct. Determine any gain or loss if the old elevator is replaced. Entry field with correct answer Loss on sale $Entry field with correct answer 54100 Click if you would like to Show Work for this question: Open Show Work SHOW SOLUTION SHOW ANSWER LINK TO TEXT Attempts: 1 of 3 used Collapse question part (b) Prepare a 4-year summarized income statement for each of the following assumptions: (1) The old elevator is retained. Retain Old Elevator Revenues $ Less costs: Variable costs $ Fixed costs Selling & administrative Depreciation Net income $ (2) The old elevator is replaced. Replace Old Elevator Revenues $ Less costs: Variable costs $ Fixed costs Selling & administrative Depreciation Operating income Less: Loss on old elevator Net income $

In: Accounting

Make CSS code for ping flood attack of the United States ** zoom in and out...

Make CSS code for ping flood attack of the United States

** zoom in and out of the map, background color, states listed, scrollbar, title Ping Flood attack in US Map, etc.

Design whatever you would want to

programming language can be any

In: Computer Science

Write fairly complete pseudocode for the Fish Wars card game.   Fish Wars is a card game...

Write fairly complete pseudocode for the Fish Wars card game.   Fish Wars is a card game where two players get 13 cards each. The cards have face values of 1-10 plus one shark card and two peace cards.

The game is played in 13 rounds. Each round, the players each play one card face down and then flip them up at the same time. The player with the higher number (plus any battle bonus) wins. No one wins on a tie. A round winner gets one point added to their score plus one battle bonus point. Play continues until all thirteen rounds are complete and the highest final score wins.

Play exception. If you play a shark card then you always win unless the opponent plays a peace card then it is a tie and no one wins. If you play a point card or a shark card against a peace card then it is a draw plus the player who did not play the peace card has their battle bonus reduced to zero.    If two peace cards are played then it is just a tie.

Your job is to write a program that simulates the Fish Wars game between a human player and an AI opponent. To start, the AI opponent can just randomly select a card. Have the program do all scoring and keep track of the battle bonus. Also make it so that the player can play the game again at the end if they want to do so.

Example of Play:

Round 1: 5 vs. 6 - Player 2 wins!    Score 0 : 1 (BB: 1)
Round 2:   3 vs. 2 (+1 BB) - Draw!    Score 0 : 1 (BB: 1)
Round 3: Shark vs. 7 (+1 BB) - Player 1 wins! Score 1 (BB: 1) - 1 (BB: 1)
Round 4: Peace (+1 BB) vs 5 (+1 BB) - Draw- Player 2 BB reduced to 0; Score 1(BB: 1) - 1 (BB: 0)
Round 5: 2 (+1 BB) vs. Shark - Player 2 wins! Score 1(BB: 1) - 2 (BB: 1)

   For this program, do not use classes and objects plus use standard C++ code and the entire code must be in one file with at most three functions.

In: Computer Science