1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
sergey [27]
3 years ago
6

Write a public static method called getPIDs that has a parameter of type Map called nameToPID (keys are student names and values

are student PIDs). It should return a HashSet containing all PIDs in nameToPID.
Computers and Technology
1 answer:
Rasek [7]3 years ago
4 0

Answer:

Java program is explained below

Explanation:

import java.util.HashSet;

import java.util.Map;

import java.util.TreeMap;

public class TruckRace1 {

   public static HashSet<String> getPIDs (Map<String,String>nameToPID ){

       HashSet<String> pidSet = new HashSet<>();

       for(String ids: nameToPID.values()){

           pidSet.add(ids);

       }

       return pidSet;

   }

   public static void main(String[] args) {

       Map<String,String> pids = new TreeMap<>();

       pids.put("John","123");

       pids.put("Jason","124");

       pids.put("Peter","125");

       pids.put("Alice","126");

       pids.put("Peny","129");

       HashSet<String> ids = getPIDs(pids);

       for(String id:ids){

           System.out.println(id);

       }

   }

}

You might be interested in
Select the correct answer.
trapecia [35]
OA. programs do not represent data-rate to xomolemrixjf complexity
6 0
4 years ago
Given the class definition: class CreateDestroy { public: CreateDestroy() { cout &lt;&lt; "constructor called, "; } ~CreateDestr
Vilka [71]

Answer:

(A)constructor called, destructor called, constructor called, destructor called.

Explanation:

In the class definition we have created a constructor which prints constructor called and a destructor which prints destructor called.Since the class contains default constructors and destructors but when we define constructor and destructor in the class defaults are removed from the class.In the code the loop is running 2 times creating a object so constructor is called when that iteration finishes it deletes that object so destructor is called and it is happening 2 times.

5 0
3 years ago
Technology is (BLANK.1 ) science that makes (blank.2) science useful and practical.
Hoochie [10]

Answer:

Example

Explanation:

Example

5 0
3 years ago
Read 2 more answers
Select the correct answer.
Naddika [18.5K]

Answer:

E

Explanation:

4 0
3 years ago
What is the foundational domain for business
mr Goodwill [35]

a fundamental domain or fundamental region is a subset of the space which contains exactly one point from each of these orbits . It serves as a geometric realisation for the abstract set of representatives of the orbits . There are many ways to choose a fundamental domain .

hope this help

7 0
3 years ago
Other questions:
  • Which of the following makes videos appear smoother and more fluid?
    9·2 answers
  • Identify the correct options to complete the following passage.
    6·1 answer
  • If a security officer is non-commissioned officer, he can carry a baton on duty if he went through a training class
    8·1 answer
  • The manager of a football stadium wants you to write a program that calculates the total ticket sales after each game. There are
    6·1 answer
  • . Convert BAC4 from hexadecimal to decimal. Show your work.
    9·1 answer
  • The World Wide Web (not the Internet) went live in this decade:
    8·2 answers
  • In a particular jurisdiction, taxi fares consist of a base fare of $4.00, plus $0.25 for every 140 meters traveled. Write a func
    11·1 answer
  • True/False: The American Standard Code for Information (ASCII) is a code that allows people to read information on a computer.
    9·2 answers
  • What type of error occurred??
    10·1 answer
  • Frank - as the Scrum Master of a Scrum Team - is invited for a Daily Scrum meeting at 9am. The teamgets together in front of the
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!