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
just olya [345]
3 years ago
12

Write a statement to create a Google Guava Multimap instance which contains student ids as keys and the associated values are st

udent profiles.
Computers and Technology
1 answer:
Sergeu [11.5K]3 years ago
8 0

Answer: provided in the explanation section

Explanation:

Note: take note for indentation so as to prevent error.

So we import com.google.common.collect.Multimap;

import java.util.Collection;

import java.util.Map;

class Main {

   public static void main(String[] args) {

       // key as studentId and List of Profile as value.

       Multimap<String,Profile> multimap = ArrayListMultimap.create();

       multimap.put("id1", new ExamProfile("examStudentId1"));

       multimap.put("id1", new ELearningProfile("userId1"));

       multimap.put("id2", new ExamProfile("examStudentId2"));

       multimap.put("id2", new ELearningProfile("userId2"));

       // print the data now.

       for (Map.Entry<String, Collection<Profile>> entry : multimap.entrySet()) {

           String key = entry.getKey();

           Collection<String> value =  multimap.get(key);

           System.out.println(key + ":" + value);

       }

   }

}

// assuming String as the studentId.

// assuming Profile as the interface. And Profile can multiple implementations that would be

// specific to student.

interface Profile {

}

class ExamProfile implements Profile {

   private String examStudentId;

   public ExamProfile(String examStudentId) {

       this.examStudentId = examStudentId;

   }

}

class ELearningProfile implements Profile {

   private String userId;

   public ELearningProfile(String userId) {

       this.userId = userId;

   }

}

This code is able to iterate through all entries in the Google Guava multimap and display all the students name in the associated students profile.

You might be interested in
What is the output of the following program?
Minchanka [31]

Answer:

the answer is t

Explanation:

7 0
3 years ago
Write a function that reads from a file the name and the weight of each person in pounds and calculates the equivalent weight in
spayn [35]

Answer:

#include <iostream>

#include <fstream>

#include <iomanip>

using namespace std;

int main(){

   string name;

   double weightKg, weightPd;

   cout<< fixed << setprecision(2);

   fstream myFile("filename.txt");

   while (getline( myFlie, name, weightPd)){

       weightKg = weight * 0.453592;

       cout<< name << weightPd <<weightKg;

   }

   myFile.close();

}

Explanation:

The C++ source code reads in the content of a file that has a name and weight value in pounds and outputs the name, weight in pounds and the weight in kilograms.

3 0
3 years ago
Software that interprets commands from the keyboard and mouse is also known as the ​
Luda [366]

Answer:

THE OPERATING SYSTEM (OS)

Explanation:

6 0
3 years ago
Suppose you have four 500 MB hard drives plus one 2 GB flash drive. How many GB of capacity is this overall?
Sidana [21]

You would have a total of 2.5 GB of capacity.

A gigabyte consists of 1000 megabytes, so 500 megabytes make half of a gigabyte, or 0.5 gigabytes.

So 2GB + 0.5GB = 2.5GB

4 0
3 years ago
Ld' is the instruction with the longest latency on the CPU from Section 4.4 (in RISC-V text). If we modified ld and sd so that t
antiseptic1488 [7]

Answer:

See explaination

Explanation:

a)

The primary factors that influence the program's speed on a new CPU are given as:-

CPU Clock speed where the speed of the process instructions is being measured.

Multi-core which is when the transistors work faster than respective CPU.

Cache which helps to note that the transition of data is smooth and fast.

b)

So, there are two CPUs suppose the old one as 'A' and the modified one as 'B'.

'A' has following features---

It takes more time to execute program as it has more clock cycle time or we can say it has low clocking rate or low speed in terms of MHz or GHz. Clock rate is the inverse of Clock Cycle Time. When you will increase the clocking rate of CPU, it will get faster and then Clock Cycle Time will get reduced.

It has less instructions provided.

'B' has following features----

It takes less time to execute program as it has less clock cycle time or we can say it has high clocking rate or high speed in terms of MHz or GHz.

It has more instructions provided.

The performance of CPU depends upon 2 factors:

The number and types of instructions that are executed by the CPU

How fast the CPU can execute those instructions?

So, overall CPU B is better as it has less execution time than CPU A but the performance will always depend upon the number and type of instructions executed by the CPU so it may vary.

Please refer to attachment for instructions and formulas.

8 0
3 years ago
Other questions:
  • What is the leading use of computers
    15·2 answers
  • 2.2-2 Consider sorting numbers stored in array by first finding the smallest element n A of and exchanging it with the element i
    11·1 answer
  • Write a C++ program in which you declare variables that will hold an hourly wage, a number of hours worked, and a withholding pe
    12·1 answer
  • ________ consists of detailed, preprogrammed instructions that control and coordinate the computer hardware components in an inf
    11·1 answer
  • To change the way a slide moves from one slide to the next, what tab should be selected?
    12·1 answer
  • When reading words using a Scanner object's next method, _________. a. any characters at the beginning of the input that are con
    5·1 answer
  • <br> Help me please I need the correct answe
    10·1 answer
  • Question # 5
    6·1 answer
  • Need help:(!!!! I’ll mark brainliest if correct
    5·1 answer
  • Simple example of hybrid computer​
    7·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!