- Create an ArrayList of Integers
- Fill each of the 10 slots with a random value from 1-50.
- Display those values on the screen, and then prompt the user for an integer.
- Search through the ArrayList, and if the item is present, print a message that the number is in the list.
- If the value is not in the ArrayList, print a message that the number is not in the list
import java.util.ArrayList;
import java.util.Random;
import java.util.Scanner;
public class Lab5Q1 {
public static void main(String[] args) {
}
}
- Create an ArrayList of Integers
- Fill the ArrayList with ten random numbers (1-50)
- Copy each value from the ArrayList into another ArrayList of the same capacity
- Change the last value in the first (original) ArrayList to a -5
- Display the contents of both ArrayLists
import java.util.ArrayList;
import java.util.Random
public class Lab5Q2 {
public static void main(String[] args) {
}
}
- Make a record to store information about a car. It should contain fields for: - make -or- brand (String) - model (String) - year (int)
- Create an ArrayList of Car objects.
- Sort the ArrayList of cars by year (Ascending) and print them out.
import java.util.ArrayList;
import java.util.List;
public class Lab5Q3 {
public static void main(String[] args){
}
}