subject

Create a new version of the class StockPurchase so that it represents the purchase of n shares of stock at d dollars per share. The revised class has the data fields share and cost, a constructor to initially set both data fields, and the accessor methods getNumberOfShares and getCostPerShare. Create a new version of the class StockLedger to contain an instance of a deque instead of a queue. The method buy creates an instance of StockPurchase and places it at the back of the deque. The method sell is now more involved. It must remove a StockPurchase object from the front of the deque and decide whether that object represents more shares than the number sold. If it does, the method creates a new instance of StockPurchase to represent the shares that remain in the portfolio. It then adds that instance to the front of the deque, since these shares would be sold next. Think about how you will handle the case when the object removed doesn't contain enough shares to satisfy the sale. Write a deque class that implements DequeInterface. java. The implementation will use a doubly linked list. You can find the interface and DLLNode. java in the Lab 3 folder in Files on canvas. Your client code from Part 1 should work with Part 2.

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 21:00
Write a method so that the main() code below can be replaced by the simpler code that calls method original main(): public class calcmiles { public static void main(string [] args) { double milesperhour; double minutestraveled; double hourstraveled; double milestraveled; milesprhour = scnr.nextdouble(); minutestraveled = scnr.nextdouble(); hourstraveled = minutestraveled / 60.0; milestraveled = hourstraveled * milesperhour; system.out.println("miles: " + milestraveled); } }
Answers: 2
question
Computers and Technology, 24.06.2019 06:30
Adrawing that places all lines parallel to the z axis at an angle from the horizon is 99 ! a. an oblique drawing b. a perspective drawing c. an auxiliary view d. a one-point perspective drawing
Answers: 2
question
Computers and Technology, 24.06.2019 18:20
7. design a circuit with three inputs (x, y, and z) representing the bits in a binary number, and three outputs (a, b, and c) also representing bits in a binary number. when the input is 1, 2, or 3, the binary output should be one lesser than the input. when the input is 4, 5, or 6, the binary output should be one greater than the input. when the input is 0, the output is 0, and when the input is 7, the output is 7. show your truth table, all computations for simplification, and the final circuit.
Answers: 2
question
Computers and Technology, 24.06.2019 22:10
Function name: poly parameters: int returns: int description: a polynomial of degree n with coefficients a0,a1,a2,a3, . . ,an is the function p(x) = a0+a1x+a2x2+a3 ∗ x3+ . . +an ∗ xn this function can be evaluated at different values of x. for example, if: p(x) = 1+2x+ x2, then p(2) = 1+2 ∗ 2+22 = 9. if p(x) = 1+x2+x4, then p(2) = 21 and p(3) = 91. write a function poly() that takes as input a list of coefficients a0, a1, a2, a3, . . , an of a polynomial p(x) and a value x. the function will return poly(x), which is the value of the polynomial when evaluated at x.
Answers: 3
You know the right answer?
Create a new version of the class StockPurchase so that it represents the purchase of n shares of st...
Questions
question
Mathematics, 31.08.2021 01:00
question
Social Studies, 31.08.2021 01:00
question
Mathematics, 31.08.2021 01:00
question
Mathematics, 31.08.2021 01:00
question
Mathematics, 31.08.2021 01:00
Questions on the website: 13722367