Suppose that you are writing a class called Zoo and have an existing class CommonName that implements Comparable. You want to be able to look up any common names for species using their species names, and to keep the species names in alphabetical order.
A species may have more than one common name. For example, "mountain lion", "cougar" and "puma" are all common names for the species Felis concolor.
The class Zoo requires an instance variable namesCollection to reference a suitable collection. Which two of the following declarations are the most suitable for namesCollection, given the above description?
1.Map<HashSet<CommonName>, String> namesCollection;2.HashMap<String, Set<CommonName>> namesCollection;3.SortedMap<String, Set<CommonName>> namesCollection;4.HashMap<SortedSet<CommonName>, String> namesCollection;5.TreeMap<String, TreeSet<CommonName>> namesCollection;6.HashMap<TreeSet<CommonName>, String> namesCollection;Programming & Design3 months ago
I have to write two instance methods to calculate the purchase cost of the material as well as its fitting cost.
Write a method calculateMaterialCost() that takes two int arguments representing the width and length in metres of the carpet to be purchased and returns the cost of the Material as a double. It should first calculate the area of the carpet then multiply this by the price. Can someone help plese :) been trying thi two nights now . Thank you
public double calculateCarpetCost(int width,int length) double calculateCarpetCost = length * width; return ??????1 AnswerProgramming & Design8 months ago