Question: I have the integer = min and max working but how do I print them? Or how do I make my integer max into an

I have the integer = min and max working but how do I print them? Or how do I make my "integer max" into an actual int so I can be able to find the range and print it?

/** * Kyle Donohue * This program will have the user input the number of objects into a LinkedList * April 17th, 2018 */ import java.util.Scanner; import java.util.LinkedList; import java.util.ListIterator; import java.util.Random; import java.util.Collections;

public class hw2 { public static void main(String[] args) { LinkedList list=new LinkedList(); Scanner in= new Scanner(System.in); System.out.print("Enter the number of objects: "); int n= in.nextInt(); Random r= new Random(); int random; for(int i=0;i iterator= list.listIterator(); integer b; int count=0; do{ b=iterator.next(); System.out.printf("%3d%9d%10d ", iterator.nextIndex(), b.getoriginal(), b.getrandom()); count++; }while(iterator.hasNext()); int sum=0; float mean; random=r.nextInt(list.size()); iterator= list.listIterator(); do{ b=iterator.next(); sum=sum+b.getrandom(); integer min = list.get(0); integer max = list.get(list.size()-1); }while(iterator.hasNext()); System.out.println(" Sum = "+sum); mean=sum/list.size(); System.out.println("Mean = "+mean); System.out.println("Range = " + ????); int med; if(list.size()%2==0){ med=list.size()/2 -1; }else{ med=list.size()/2; } System.out.println("Median= "+list.get(med).getrandom()); } }

*******************************

/* * Kyle Donohue * hw * * */ import java.util.Comparator; import java.util.List; public class integer implements Comparable{ int random; int original;

public integer(int r,int o) { random=r; original=o; } public int getoriginal(){ return original; }

public int getrandom(){ return random; } @Override public int compareTo(integer a){ if(a.random==this.random){ return 0; }else{ if(this.random>a.random){ return 1; }else{ return -1; } } } }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!