Question
Was given this java assignment to do and I am completely lost on how to do it 1) (50 Points) In your Java project, create
Was given this java assignment to do and I am completely lost on how to do it
1) (50 Points) In your Java project, create and call a void method (or methods) that
stores 5 million random integers in a linked list
outputs the time taken to traverse the linked list using an iterator
outputs the time taken to traverse the linked list using the method get(index)
2) (50 points) Compilers render normal infix expressions into postfix expressions. Postfix notation allows expressions to be written without parenthesis or the strange rules of infix evaluation, which greatly speeds up the processing of an expression during runtime. For example,
the infix expression 2 + 3 would be written 2 3 + in postfix
the infix expression ( 5.0 3.5 ) / 1.2 would be written 5.0 3.5 1.2 / in postfix
A postfix expression is evaluated using a stack. Scanning the postfix expression from left to right, place each operand encountered on the stack top. When an operator is encountered, pop the top two operands off the stack, apply the operator and place the result on the stack top. When the expression has been scanned, the sole remaining value on the stack is the result.
In your Java project, create and call a method that receives a postfix expression in a parameter of type String, evaluates it and returns the result of the expression as a double. In your method, assume that all values and symbols in the parameter will each be separated by a space. Assume that the only operators will be +, -, * and /.
Call the method with the following postfix expressions and output the results of each call. 23+ 5.03.51.2/ 5.03.51.2-/
3) (50 points) Create a Java class named Circle that implements java.io.Serializable interface (for more information see: https://docs.oracle.com/javase/7/docs/api/java/io/Serializable.html) and models a circle based on radius. Radius cannot be less than zero. Implement the getter and setter method for radius. Also include an overriding of toString in the circle class. Create the class' comparator which compares two objects of type Circle.
4) (50 points) Implement the following generic Java method using an O(n2) sort and a comparator:
public static
Write test program that creates a list of at least 5 elements of the class type created in problem 3 above, calls the above method to sort the list, then outputs the sorted list via calls to toString.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started