lilly Rankine

Ranch Hand
+ Follow
since Nov 29, 2019
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by lilly Rankine

that method was already given and I just need to identify each method. As I have said before.. they are correct as I checked but not sure what setHappy is . options that are left are import, class, overload or local variable.
8 months ago
so its a quiz and its correct but I am not sure what setHappy is
8 months ago
so below is the code and I have to slelect the correct option for each of the method. I have not written them here as there was no need. I have all the correct answers but I am stuck on one which is setHappy. The options are below if anyone can help.




setName is a...done


name is a... done


isHappy is a... done


getName is a... done


setHappy is a.... options that are left are import, class, overload or local variable. Which on is it? Many thanks


public Dog()

is the header for a.. done



The superclass of Dog... done


happy is a.. done

8 months ago
so looking at those links just confused me. I just want to know about my code.
8 months ago
So I have written a small code and realised although I know how to code I never really thought about things like local variable identifier and so on. Can someone help me identify the mehods of my code below:



eg. which is the local variable identifier and the formal argument identifier,  signature of the method, header of the method is i guess public boolean isEven. Return type is string for eg.
8 months ago
yes its a list string. I am attempting to put a String value in to a map that has a List<String> value type. I think I  should wrap this string with a list before attempting to add it to list but domt know how
9 months ago
when I execute the following.. it says method put in interface java.util.Map<K,V> cannot be applied to given types;
requited:java.lang.integer.java.util.List<java.lang.String>; found int java lang string; reason actual argument java.lang.string cannot be converted etc etc


public class Employees
{
 private Map<Integer, List<String>>employees;

 public Employees() {
     employees = new HashMap<Integer,List <String>>();
 }
 public void populateMap() {
       employees.put(110, "Ashraf Faisal");
       employees.put(111, "Toby Ashford");
       employees.put(112, "Johnny Bravo");
       employees.put(113, "Tim Holton");
       
 }

9 months ago
so like this

private Map<Integer, List<String>> employees; ?
9 months ago
I have also changed the following:

public void printMapValue(List <String> key)
9 months ago
Hi Knute... when I do the following

public class Employees
{
 private Map<Integer, List<String>>(it says
identifier expected)

9 months ago
I havent added list properly. It needs to be in the header somewhere. and simply using System.out.println() with the map as argument is not an acceptable solution (that is a requirement)
9 months ago
Requirements are
The keys must be of type String or Integer... in this case key is employee ID so integer
The value types must be either a List or a Set.. value is the name of the employees so needs to be a string list.
I am not sure where to add the list in the header. I think I have messed up the code.

here is my code:
import java.util.*;

9 months ago
here is what I have so far but it is not compiling because the value needs to be a list and the key is an integar.

9 months ago
Include constructor that creates an empty map of a suitable type and assigns it to my maps instance variable.

I am creating a hashmap with class worked. It includes worker ID which is the integer and worker name which is string. This is what I have done so far. I am not sure how to do the above?



This is what I have tried.. unsure if its whats the aboves asking for:


9 months ago