what is the relationship between social media usage and academic performance outcomes in college students? one page
In: Biology
What can more colleges do to engage students in civic and community engagement in the area of service-learning?
In: Operations Management
q1
a)how important is sap for graduate students
b)what is the most important certifications in business field
In: Operations Management
if two people are randomly selected from a class of 30 students, what is the probability that they have the same birthday?
In: Math
Why is it important to place students in the least restrictive environment, and how often should this setting be reviewed for effectiveness?
?
In: Psychology
QUESTION 3
Discuss the major issues in teaching and supervising
students in counseling practice. Explain 10
issues.
In: Psychology
You must alter the Queue class you created in L5 to make it a CIRCULAR Queue class . Call your class Queue. it must be a template class.
public class Queue <T>{
}
I have put a driver program in the module . It is called CircularQueue.java
This driver program should then run with your Queue class (no modifications allowed to the driver program).
Your Queue class should have at least the following methods: one or more constructors, enqueue, dequeue, peek, isEmpty, getSize, makeEmpty, and printQ.
printQ takes one parameter (an integer) and has return type void. printQ(30) will print 30 elements in the queue. If the queue has fewer than 30 elements (and because it is circular) then you will just keep on going round and round until you have printed out all 30.
Upload your Queue class ONLY to canvas.
Queue Class
import java.util.LinkedList;
public class Queue<T> { //generic class
LinkedList<T> list; // defing linked list: - it implements
both list and dequeue interface
// Queue follows first in last out approach
Queue() { //constructor
list = new LinkedList<>(); //inititalizing linkedList
}
void enqueue(T element) { //add element at the last of the
list
list.addLast(element);
}
T dequeue() {
if (list.isEmpty() == false) {
return list.pollFirst(); //Retrieves and removes the first element
of this list
} else {
System.out.println("List is empty!");
return null;
}
}
int getSize() { // return size of the list
return list.size();
}
void peek() { //Retrieves, but does not remove, the first
element of this list.
if (list.isEmpty() == false) {
System.out.println(list.peek());
} else {
System.out.println("List is empty!");
}
}
boolean isEmpty() {
if (list.isEmpty()) {
return true;
} else {
return false;
}
}
void makeEmpty() {
list.removeAll(list);
}
Code must have
constructor
enqueue
dequeue
peek
isEmpty
getSize
makeEmpty
printQ
In: Computer Science
I Have posted my Java code below. Fix the toString, add, and remove implementations so that the following test cases work.
Note: I have removed all the unnecessary inherited List implementations. I have them to: throw new UnsupportedException(); For compilation, you could also add //TODO.
Test (Main)
List list = new SparseList<>(); list.add("0");
list.add("1");
list.add(4, "4");
will result in the following list of size 5: [0, 1, null, null, 4].
list.add(3, "Three");
will result in the following list of size 6: [0, 1, null, Three,
null, 4].
However,
list.set(3, "Three);
is going to produce a list of size 5 (unchanged): [0, 1, null,
Three, 4].
When removing an element from the list above, via list.remove(1)); the result should be the following list of size 4: [0, null , Three, 4]
Using the other constructor, List list = new SparseList<>(); would just result in all the null values produced by remove, get, set and toString be replaced with the specified value, e.g., [0, 1, null, null, 4]. Consider completing the implementation of your class with the default constructor only first, and then make the needed modifications.
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;
public class SparseList implements List{
private int endIndex = 0;
private HashMap list;
public SparseList() {
list = new HashMap<>();
}
public SparseList(E[] arr) {
list = new HashMap<>();
for(int i = 0; i
list.put(i, arr[i]);
}
endIndex = arr.length - 1;
}
@Override
public boolean add(E e) {
endIndex++;
list.put(endIndex, e);
return true;
}
@Override
public void add(int index, E element) {
list.put(index, element);
}
@Override
public E remove(int index) {
return list.remove(index);
}
@Override
public E get(int index) {
return list.get(index);
}
@Override
public E set(int index, E element) {
E previous = list.get(index);
list.put(index, element);
return previous;
}
@Override
public int size() {
return endIndex + 1;
@Override
public void clear() {
list.clear();
}
@Override
public boolean isEmpty() {
return list.isEmpty();
}
@Override
public String toString() {
return list.toString();
}
}
In: Computer Science
Discuss what Proton MRI imaging of the lung is. Discuss the indication, advantages and disadvantages of using this technique when evaluating V/Q mismatch. Discuss how different pulmonary diseases can be better identified and treated using this technique.
In: Nursing
Your body can defend you from any antigen that enters
your body as long as that antigen is a foreign antigen.
How can your body generate such a diverse variety of
antibodies? (2) Hint V and J chains
In: Biology