1Suppose you are implementing software to be used in a handheld device that checks whether event attendees are part of a group of people allowed access to a special session at the event. Guests can purchase access to the special session any time up to the instant the event begins, and the device receives updated records to ensure paying guests (only) are allowed in to the special session Would choosing a set data structure to manage the special session guests or a list be more efficient? Explain
2. The methods listed in the Java SE 8 API for the
java.util.HashMap class include get(Object key) which returns the
value that is associated with the Object in key, or null if there
is no association with that key put(K key, V value) which creates
an association in the map from the key in key to the value in
value. If the key exists already, the value in value is set as the
new associated value for key The K and V are generic type labels,
since java.util.HashMap is a generic class that declares two
generic type parameters <K,V>
Based on your understanding of the design of a map, for each of the
following actions 1 through 3 write in words the result of each of
the following actions on a HashMap, and write out which
associations are currently in the map:
(1) call the put method to make an association between the String
“high” and the String “low”
(2) call the put method to make an association between the String “high” and the String “voltage”
(3) call the get method to get the value associated with the
String “high”
1. For the above case study, as we need to keep on adding the people names into the list until the concert begins. Thus we will need constant updations thus we need fast time as well as a fast lookup. As when people will enter, we need to check whether the name has booked or not.
Thus these two fast updations are lookup are there fast with O (1) complexity for updating and O(1) for lookup.
But in case of list, it is very slow.
Thus for this purpose, set data structure is best for the implementation for the above case.
Being a Chegg expect I am obliged to do only one question at a time. I hope you understand.
Thanks
1Suppose you are implementing software to be used in a handheld device that checks whether event...
//MultiValuedTreeMap.java import java.util.Iterator; import java.util.LinkedList; import java.util.TreeMap; //import java.util.ArrayList; public class MultiValuedTreeMap<K, V> extends TreeMap<K, LinkedList<V>> implements Iterable<Pair<K, V>> { private static final long serialVersionUID = -6229569372944782075L; public void add(K k, V v) { // Problem 1 method // empty linked list, with key=k if (!containsKey(k)) { put(k, new LinkedList<V>()); } // adding v to the linked list associated with key k get(k).add(v); } public V removeFirst(K k)...
need this in #c
. You will now add server side validation code to the
frmPersonnel page. Currently, when the Submit button is pressed,
the frmPersonnelVerified page is displayed. This is because the
frmPersonnelVerified page is set as the Submit button's PostBackUrl
property. Instead of having the page go directly to the
frmPersonnelVerified page when the Submit button is pressed, we
want to do some server side validation. If any of the validation
rules fail, we will redisplay the frmPersonnel...
CSC 142
Music Player
You will complete this project by implementing one class.
Afterwards, your program will play music from a text file.
Objectives
Working with lists
Background
This project addresses playing music. A song consists of notes,
each of which has a length (duration) and pitch. The pitch of a
note is described with a letter ranging from A to G. 7
notes is not enough to play very interesting music, so there are
multiple octaves; after we reach...
please help!!!! JAVA
I done the project expect one part but I still give you all the
detail that you needed...
and I will post my code please help me fix the
CreateGrid() part in main and make GUI works
List Type Data Structures
Overview :
You will be implementing my version of a linked list. This is a
linked list which has possible sublists descending from each node.
These sublists are used to group together all nodes which...
IN JAVA: Write a class, ZeroException, which is an Exception, and is used to signal that something is zero when it shouldn't be. Write the class ArrayManipulator which creates an array and provides several methods to manipulate values taken from an array. ZeroException Task: Exceptions are used to signal many types of problems in a program. We can write our own as well to describe specific exceptional conditions which may arise. The advantage of doing so is that when exceptions...
LAB PROMPT: Lab 07 Hello future bakers and artisans of the fine gourmet. You love to throw parties, and what goes better at a party than cake! The problem is that you only have enough flour to bake a limited number of cakes. In this lab, you will write a small program to figure out if you have enough flour to bake the number of cakes needed for the people attending. Step 1 - using final At the top of...
1 Overview For this assignment you are required to write a Java program that plays (n, k)-tic-tac-toe; (n, k)-tic- tac-toe is played on a board of size n x n and to win the game a player needs to put k symbols on adjacent positions of the same row, column, or diagonal. The program will play against a human opponent. You will be given code for displaying the gameboard on the screen. 2 The Algorithm for Playing (n, k)-Tic-Tac-Toe The...
could you please help me with this problem, also I
need a little text so I can understand how you solved the
problem?
import java.io.File; import java.util.Scanner; /** *
This program lists the files in a directory specified by * the
user. The user is asked to type in a directory name. * If the name
entered by the user is not a directory, a * message is printed and
the program ends. */ public class DirectoryList { public static...
Complete the following assignment with the tester class
included.
*If the text is too small in the pictures to read, open a new
window and copy and paste the address below into the search bar,
and go to that page for the same instructions in the pictures
below:
This is the address for the same instructions in the
pictures below:
https://www.chegg.com/homework-help/questions-and-answers/purpose-purpose-lab-design-write-many-complex-methods-working-arrays-array-list-objects-ma-q37244441?trackid=6abm6xXV
Tester Class:
public class Tester
{
/**
* main() method
*/
public static void main(String[] args)
{
// No...
can i get some help with this program
CMPS 12B Introduction to Data Structures Programming Assignment 2 In this project, you will write a Java program that uses recursion to find all solutions to the n-Queens problem, for 1 Sns 15. (Students who took CMPS 12A from me worked on an iterative, non-recursive approach to this same problem. You can see it at https://classes.soe.ucsc.edu/cmps012a/Spring l8/pa5.pdf.) Begin by reading the Wikipcdia article on the Eight Queens puzzle at: http://en.wikipedia.org/wiki/Eight queens_puzzle In...