Question: 1 1 . 1 0 ArrayList practice Practice creating an ArrayList and some of its functions Import the appropriate packages to use the ArrayList and
ArrayList practice
Practice creating an ArrayList and some of its functions
Import the appropriate packages to use the ArrayList and Scanner classes
In the main method
Use the given code to begin writing your program
Write the code to get four integer values from the user and put them in the rateList. Use a loop.
Prompt user for a number to add and add it to the rateList
Prompt user for a number to check
Write the code for the first containsValue method to allow the lines of code to execute and show results
Prompt user for a number and index to check
Write the code for the second containsValue method to allow the lines of code to execute and show results
Create a method containsValue that takes two parameters: an ArrayList of integers and an integer value
Use an arraylist method to check if the value passed as an argument is in the list
For instance, with an input of if the number is in the list, display the following output:
The number is in the list
If the number is not in the list, display the following output:
The number is not in the list
Overload the method containsValue to include three parameters: an ArrayList of integers, an integer for a value, and an integer for an index
Check if the value is located in the given index location
For instance, with an input of and index if the value in index is display the following output:
The number is at index
If the value at index is not display
The number is not at index
Display if the number is in another index, or not in the list at all
The number is at index
or
The number is not in the list
JAVA PLEASE
USE THIS CODE
imports
add your code here
public class ArrayListExample
public static void mainString args
Variables these should be enough, but you may add additional variables if you need to
Scanner scnr new ScannerSystemin;
int number, index;
ArrayList rateList new ArrayList;
get values from user and put them in the rateList
System.out.printlnEnter four integer values: ;
add your code here
System.out.printlnList values: rateList;
get number from user
add your code here
add number to the arrayList
add your code here
System.out.printlnList values: rateList;
check if value added is in the list
System.out.printEnter a number to check: ;
add your code here
get value and index from user
add your code here
add number at index value
add your code here
System.out.printlnList values: rateList;
get value and index from user to check
add your code here
check if value exists at specific index location
add your code here
Checks if the value is contained in the rateList
Displays an appropriate message to indicate if the value is in or is not in the list
@param rateList
@param value
public static void containsValue add your code for parameters here
add your code here
Checks if the value is contained in the rateList at the index location
Displays an appropriate message to indicate if the value is in the location,
if it is in the list but in another location, or is not in the list
@param rateList
@param value
@param index
public static void containsValue add your code for parameters here
add your code here
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
