Implement a java program that uses a linkedlist

Assignment Help JAVA Programming
Reference no: EM133135251

COIT20256 Data Structures and Algorithms - Central Queensland University

Lab Exercises

Question 1. As part of Activity One you have written the contents in the resulting LinkedList - myList, after each step of execution if the following program code is executed. Test your answer by implementing the program. (submit your code).

LinkedList<String> myList = new LinkedList<>(); ListIterator<String> iter; myList.addFirst("John"); myList.addFirst("David");
iter = myList.listIterator(); iter.next(); iter.add("Peter"); iter.next(); iter.add("Joshua");

Question 2. Create a PriorityQueue of type Integer named eventMonths and add the following values:
2, 5, 8, 3, 11, 7,and 6.
Display the values using the peek method. (Check your answer from your Activity Two. Submit your code)
Remove 2 from the queue and add 12. Remove 3 and add 4 to the queue.
Display the queue.

Question 3. Implement your Activity three and submit your source code.

Question 4. (Inserting Elements in a LinkedList in Sorted Order) Write a program that inserts 25 random integers from 0 to 100 in order into a LinkedList object. The program should sort the elements, then calculate the sum of the elements and the floating-point average of the elements.

Question 5. (Copying and Reversing Linkedlists) Write a program that creates a LinkedList object of 10 characters, then creates a second LinkedList object containing a copy of the first list, but in reverse order.

Question 6. Implement a Java program that uses a LinkedList to store Integer objects that have the following values from an array
Integer[] arr = {-1, 17, 28, -39, 12, 6, -2,-10};
Use an iterator to traverse the linkedlist and replace each negative value by the corresponding positive number and doubled. Print out the contents of the resulting list.

Question 7. Write an application to implement the three Set operations: intersection, union, and difference. You should build three methods corresponding to the operations. In your main method, test these methods on two HashSets of Strings.

Question 8. Use a HashMap to create a reusable class for choosing one of the13 predefined colours in class Color. The names of the color should be used as keys, and the predefined Color objects should be used as values. Place this class in a package that can be imported into any java program. Use your new class in an application that allows the user to select a color and draw a shape in that color.

Question 9. Write a Java class named StudentEmail that has data members for the name and number of a student. The class should have a constructor and appropriate accessor and mutator methods. In addition, the toString method should include the output information with student name, student number and the corresponding e-mail address.

You write a program that creates a GUI with two labelled text fields, each one for name and student number, a text area to display the information, and two buttons - ‘add' and ‘delete'. After the user of program enters data using the text fields and presses the ‘add' button a StudentEmail object is created and stored in a LinkedList, and the student name, number and e-mail are displayed in the text area. If the user wants to delete a student e-mail entry, user can enter the student name in the text field and press the ‘delete' button. If the entered student name doesn't match any name in the LinkedList, a dialog message box pops out to indicate this.

Attachment:- Data Structures and Algorithms.rar

Reference no: EM133135251

Questions Cloud

What is feedback and why is it necessary : One of the roles of a volunteer supervisor is to give feedback and performance evaluation information to volunteers. What is feedback and why is it necessary?
Determine total stockholders equity after stock dividend : An 18% stock dividend is declared and paid when the market value was $16 per share. Determine total stockholders equity after stock dividend
Explain the rights of volunteers : Explain the rights of volunteers and what is expected from organisations who take volunteers.
How a firms strategy affects its recruiting efforts : 1. Briefly explain how a firms strategy affects its recruiting efforts.
Implement a java program that uses a linkedlist : Implement a Java program that uses a LinkedList to store Integer objects that have the following values from an array
Advantages and disadvantages of e-recruitment : 1. The New Normal for hiring (The Puzzle)
Compare and contrast corporate and business strategy : Compare and contrast corporate and business strategy. What is the difference between the two?
Strategies that use innovative management techniques : What are 3 diverse strategies that use innovative management techniques, operational practices, or technology that could be applied to improve workforce perform
Prepare a company policy document : You will prepare a company policy document for a company operating in three countries. The policy covers expatriate assignments on leading practices including:

Reviews

Write a Review

JAVA Programming Questions & Answers

  Recursive factorial program

Write a class Array that encapsulates an array and provides bounds-checked access. Create a recursive factorial program that prompts the user for an integer N and writes out a series of equations representing the calculation of N!.

  Hunt the wumpus game

Reprot on Hunt the Wumpus Game has Source Code listing, screen captures and UML design here and also, may include Javadoc source here.

  Create a gui interface

Create GUI Interface in java programing with these function: Sort by last name and print all employees info, Sort by job title and print all employees info, Sort by weekly salary and print all employees info, search by job title and print that emp..

  Plot pois on a graph

Write a JAVA program that would get the locations of all the POIs from the file and plot them on a map.

  Write a university grading system in java

University grading system maintains number of tables to store, retrieve and manipulate student marks. Write a JAVA program that would simulate a number of cars.

  Wolves and sheep: design a game

This project is designed a game in java. you choose whether you'd like to write a wolf or a sheep agent. Then, you are assigned to either a "sheep" or a "wolf" team.

  Build a graphical user interface for displaying the image

Build a graphical user interface for displaying the image groups (= cluster) in JMJRST. Design and implement using a Swing interface.

  Determine the day of the week for new year''s day

This assignment contains a java project. Project evaluates the day of the week for New Year's Day.

  Write a java windowed application

Write a Java windowed application to do online quiz on general knowledge and the application also displays the quiz result.

  Input pairs of natural numbers

Java program to input pairs of natural numbers.

  Create classes implement java interface

Interface that contains a generic type. Create two classes that implement this interface.

  Java class, array, link list , generic class

These 14 questions covers java class, Array, link list , generic class.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd