Questions
Why did students find that the psychiatric literature they had studied had not prepared them for...

Why did students find that the psychiatric literature they had studied had not prepared them for work in a clinical setting?

In: Nursing

What could be the challenges and problems of Internet-based education for nursing students? I need it...

What could be the challenges and problems of Internet-based education for nursing students?

I need it with reference please thanks.

In: Nursing

what are hallucinations and how can we prevent high school students from taking the drugs at...

what are hallucinations and how can we prevent high school students from taking the drugs at a musical festival?

In: Biology

Write a persuasive speech on whether online or face to face learning/education is better for primary,...

Write a persuasive speech on whether online or face to face learning/education is better for primary, secondary and tertiary students

In: Psychology

How could a college or university more effectively use Facebook and Twitter to promote its brand...

How could a college or university more effectively use Facebook and Twitter to promote its brand to potential students?

In: Operations Management

Write an essay on '' How students spend reasonably and economically for their future''. The essay...

Write an essay on '' How students spend reasonably and economically for their future''.

The essay must not exceed 2,000 Characters in length.

In: Operations Management

why newly graduated high school students should consider trade and vocational school instead of the traditional...

why newly graduated high school students should consider trade and vocational school instead of the traditional college?

In: Psychology

3- Use FirstLastList: Write method public void join(FirstLastList SecondList) such that given two linked lists, join...

3- Use FirstLastList: Write method public void join(FirstLastList SecondList) such that given two linked lists, join them together to give one. So if the lists lst1= [1,3,7,4] and lst2=[2,4,5,8,6], the result of lst1.join(lst2) is lst1=[1,3,7,4,2,4,5,8,6] and lst2=[].
4- Use FirstLastList: Write method public void swap(). It swaps the first and last elements of a FirstLastList. So if lst1= [1,3,7,4], lst1.swap() = [4,3,7,1]. Display or throw an exception if the list contains less than two elements.

public class FirstLastList
{
private Link first; // ref to first link
private Link last; // ref to last link
// -------------------------------------------------------------
public FirstLastList() // constructor
{
first = null; // no links on list yet
last = null;
}
// -------------------------------------------------------------
public boolean isEmpty() // true if no links
{ return first==null; }
// -------------------------------------------------------------
public void insertFirst(long dd) // insert at front of list
{
Link newLink = new Link(dd); // make new link

if( isEmpty() ) // if empty list,
last = newLink; // newLink <-- last
newLink.next = first; // newLink --> old first
first = newLink; // first --> newLink
}
// -------------------------------------------------------------
public void insertLast(long dd) // insert at end of list
{
Link newLink = new Link(dd); // make new link
if( isEmpty() ) // if empty list,
first = newLink; // first --> newLink
else
last.next = newLink; // old last --> newLink
last = newLink; // newLink <-- last
}
// -------------------------------------------------------------
public long deleteFirst() // delete first link
{ // (assumes non-empty list)
long temp = first.dData;
if(first.next == null) // if only one item
last = null; // null <-- last
first = first.next; // first --> old next
return temp;
}
// -------------------------------------------------------------
public void displayList()
{
System.out.print("List (first-->last): ");
Link current = first; // start at beginning
while(current != null) // until end of list,
{
current.displayLink(); // print data
current = current.next; // move to next link
}
System.out.println("");
}

public void join(FirstLastList otherList) {
Link current = otherList.first; // start at beginning
while (current != null) { // until end of list,
this.insertLast(current.dData);
current = current.next; // move to next link
}
otherList.first = null;
}

public void swap() throws Exception {
int count = 0;
Link current = first; // start at beginning
while (current != null) { // until end of list,
count++;
current = current.next; // move to next link
}
  
if (count < 2) {
throw new Exception("There is not enough element in the list.");
} else
{
long firstData = first.dData;
long lastData = last.dData;
first.dData = lastData;
last.dData = firstData;
}
}
}

class Link
{
public long dData; // data item
public Link next; // next link in list

public Link(long d) // constructor
{ dData = d; }

public void displayLink() // display this link
{ System.out.print(dData + " "); }
} // end class Link

public class FirstLastAppTest
{
public static void main(String[] args)
{
FirstLastList lst1 = new FirstLastList(); // Start a new FirstLastList called lst1

lst1.insertLast(1); // Add links with data to the last position
lst1.insertLast(3);
lst1.insertLast(7);
lst1.insertLast(4);
System.out.print("\nlst1: "); // print the description for the list
lst1.displayList(); // print the contents of the list

FirstLastList lst2 = new FirstLastList(); // Start a new FirstLastList called lst2

lst2.insertLast(2); // Add links with data to the last position
lst2.insertLast(4);
lst2.insertLast(5);
lst2.insertLast(8);
lst2.insertLast(6);
System.out.print("\nlst2: "); // print the description for the list
lst2.displayList(); // print the contents of the list

System.out.print("\nlst1.join(lst2): "); // print the action to take place: lst1.join(lst2)
lst1.join(lst2); // call the join method for lst1 to add lst2
System.out.print("\nlst1: "); // print the description for the list
lst1.displayList(); // print the contents of the list lst1; post join()
System.out.print("lst2: "); // print the description for the list
lst2.displayList(); // print the contents of the list lst2; post join()

System.out.print("\nlst1.swap(): "); // print the action to take place: lst1.swap()
lst1.swap(); // call the swap method for lst1
System.out.print("\nlst1: "); // print the description for the list
lst1.displayList(); // print the contents of the list lst1; post swap()
} // end main()
} // end class

I can't get FirstLastAppTest to work with my code. I can't post my FirstLastApp as I have limited space for 1 question.

PLEASE DO NOT MODIFY FirstLastAppTest!!! Its just for testing the code.

In: Computer Science

A group of students estimated the length of one minute without reference to a watch or...

A group of students estimated the length of one minute without reference to a watch or clock, and the times (seconds) are lis

A group of students estimated the length of one minute without reference to a watch or clock, and the times (seconds) are listed below. Use a 0.01 significance level to test the claim that these times are from a population with a mean equal to 60 seconds. Does it appear that students are reasonably good at estimating one minute?

 72 79 42 66 41 23 63 65 67 48 65 72 96 88 68 

Assuming all conditions for conducting a hypothesis test are met, what are the null and alternative hypotheses? 

In: Math

Professor Very Busy needs to allocate time next week to include time for office hours. He...

Professor Very Busy needs to allocate time next week to include time for office hours. He needs to forecast the number of students who will seek appointments. He has gathered the following data:

Week #Students
6 Weeks ago 83
5 Weeks ago 110
4 Weeks ago 95
3 Weeks ago 80
2 Weeks ago 65
Last Week 50

  
What is this week's forecast using exponential smoothing with alpha = .2, if the forecast for two weeks ago was 90?

In: Other