Hello, I have answered this question before. Please find your answers below and let me know if you have any doubts or if you need anything to change. If you are satisfied with the solution, please rate the answer. Thanks
17. Tradable t = new Bond();
This statement is completely valid since Bond implements Tradable interface indirectly. That is Bond extends Debt which extends FinancialSecurity that implements Tradable. So according to the inheritance hierarchy, Bond is a child class of Tradable.
Java code for each of the below classes/interfaces. Assuming there are no abstract classes in the diagram.
18. Tradable
import java.util.Date;
public interface Tradable {
public double getPrice();
public Date getLastTradeTime();
}
19. Stock
public class Stock extends Asset {
// no info about the additional data fields or methods
}
20. Bond
public class Bond extends Debt{
// no info about the additional data fields or methods
}
21. FinancialSecurity
import java.util.Date;
public class FinancialSecurity implements Tradable {
@Override
public double getPrice() {
// should return a double value
return 0;
}
@Override
public Date getLastTradeTime() {
// should return a Date value, returning null for now.
return null;
}
}
questions based from above handout CUNY/CSI CODE LISTING 1 public Interface Calculator f public double getCurrentValue); public class Simplecalculator implements Calculator ) public Class Finan...
questions are based from above handout CODE LISTING 1 public Interface Calculator ( public double getCurrentValue) public Class Simplecalculator implements Calculator t) public Class FinancialCalculator extends Simplecalculator t public class Scientificcalculator extends SimpleCalculator [UML DIAGRAM) FIGURE 1 Tradalla FinancialSecany +gell ast TradaTine: Date Debt Asset Bond ETF Stock ConvertabloBond 05/21/2019 FinalExam Clas (20 points) ses. Interfaces and their Documentation: The following section of exercises is based on Final Exam Handout Number 2 ( Code). 16. Examine the four entities defined...
[Continued] Your Course class should have: 1)a getter for the course 'code', so that it is read-only; 2)a getter and setter for the lecturer attribute, so that it is readable and writable; 3)a constructor that creates the associations shown in the UML diagram; 4)an enrolStudent method that adds a given Student object into the 'enrolled' set; 5)a withdrawStudent method that removes a given Student object from the 'enrolled' set and returns true if the student was successfully found and removed,...
1-Suppose you write an application in which one class contains code that keeps track of the state of a board game, a separate class sets up a GUI to display the board, and a CSS is used to control the stylistic details of the GUI (for example, the color of the board.) This is an example of a.Duck Typing b.Separation of Concerns c.Functional Programming d.Polymorphism e.Enumerated Values 2-JUnit assertions should be designed so that they a.Fail (ie, are false) if...
------------------------------------------------------------------------------------------------------------ CODE ALREADY HAVE BELOW--------------------------------------------------------------------------------------- public class LinkedQueue<T> implements QueueADT<T> { private int count; private LinearNode<T> head; private LinearNode<T> tail; public LinkedQueue() { count = 0; head = null; tail = null; } @Override public void enqueue(T element) { LinearNode<T> node = new LinearNode<T> (element); if(isEmpty()) head = node; else ...
Additional code needed: PartA: BurgerOrder class (1 point) Objective: Create a new class that represents an order at a fast-food burger joint. This class will be used in Part B, when we work with a list of orders. As vou work through this part and Part B, draw a UML diagram of each class in using the UML drawing tool 1) Create a new Lab5TestProject project in Netbeans, right-click on the lab5testproject package and select New>Java Class 2) Call your...