JAVA, please help me edit my code....the last 2 line supposed to show the City name but stead it's showing employee name, please help me edit the last 4 line should be (similar like this) The oldest employee is: Susan The youngest employee: Maria The city with highest population is: Los Angeles The city with lowest population is: Santa Monica but mine is showing Susan Maria on all four line so... please edit my code import java.util.Scanner; public class Generics2 { public static void main(String[] args) { Scanner scan = new Scanner(System.in); String name; int age, population; Employee[] employees = new Employee[3]; City[] cities = new City[3]; for (int i = 0; i < cities.length; i++) { System.out.println("Collecting Employee" + (i + 1) + " Information"); System.out.println("nPlease enter Employee" + (i + 1) + " name: "); name = scan.nextLine(); System.out.println("Please enter Employee" + (i + 1) + " Age: "); age = scan.nextInt(); scan.nextLine(); System.out.println(); employees[i] = new Employee(name, age); } for (int i = 0; i < cities.length; i++) { System.out.println("Collecting City" + (i + 1) + " Information"); System.out.println("nPlease enter City" + (i + 1) + " name: "); name = scan.nextLine(); System.out.println("Please enter City" + (i + 1) + " population: "); population = scan.nextInt(); scan.nextLine(); System.out.println(); cities[i] = new City(name, population); } HighestLowest emp = new HighestLowest<>(employees); HighestLowest c = new HighestLowest<>(cities); System.out.println("The oldest employee is: " + ((Employee) emp.getHighest()).getName()); System.out.println("The youngest employee is: " + ((Employee) emp.getLowest()).getName()); System.out.println("The city with highest population is: " + ((City) c.getHighest()).getName()); System.out.println("The city with lowest population is: " + ((City) c.getLowest()).getName()); } } class HighestLowest
Delivering a high-quality product at a reasonable price is not enough anymore.
That’s why we have developed 5 beneficial guarantees that will make your experience with our service enjoyable, easy, and safe.
You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.
Read moreEach paper is composed from scratch, according to your instructions. It is then checked by our plagiarism-detection software. There is no gap where plagiarism could squeeze in.
Read moreThanks to our free revisions, there is no way for you to be unsatisfied. We will work on your paper until you are completely happy with the result.
Read moreYour email is safe, as we store it according to international data protection rules. Your bank details are secure, as we use only reliable payment systems.
Read moreBy sending us your money, you buy the service we provide. Check out our terms and conditions if you prefer business talks to be laid out in official language.
Read more