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

  Create a scatterplot visualization

Create a Scatterplot visualization that reads data from a comma-separated text file. The visualization code should be written in Java using Processing.

  Write application that prompts user for a month day and year

Write an application that prompts a user for a month, day, and year. Display a message that specifies whether the entered date is not this year and in an earlier month this year.

  Write an application that prompts an employee

Write an application that prompts an employee for an hourly pay rate and hours worked. Compute gross pay (hours times rate), withholding tax, and net pay

  Construct 4 instances of your instrument

Create a Java test class that simulates using your MusicalInstrument class.  In your test class you should at a minimum construct 4 instances of your instrument,

  Develop one application using jtabbedpanes and jframes

Develop one application using JTabbedPanes and JFrames and another application that connects to a MySQL database.

  Create a console based non-gui java program

Create a console based, non-GUI Java program using NetBeans Integrated Development Environment (IDE) that displays "Hello world!" Take a screenshot that shows the program's successful compilation and execution. Submit both a copy of your program a..

  What is the java method doing

What is the following method doing? Please clearly describe it.

  Write a program with an exception handler

Write a program with an exception handler that deals with nonnumeric operands; then write another program without using an exception handler to achieve the same objective.

  Scanning and parsingimplement the lexical and syntactic

scanning and parsingimplement the lexical and syntactic analysis of minifun programming language. the scanner splits up

  Write a pre-condition and post-condition for this method

Consider the partial Java interface for the BagCQS ADT given in the Supplement. Note that this interface conforms to the principle of Command Query Separation.

  Define private instance variable to hold boolean value

Write a Java Enumeration "LetterGrade" that represents letter grades A through F including plus and minus grades. Define a private instance variable to hold a boolean value.

  Program that will predict the size of a population

Program that will predict the size of a population of organisms. The program should ask the user for the starting number of organisms, their average population

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