Exercise 2.1 | ArrayList Instruction 1. Create a Java class in the _1_CS201 Your Last NameFirstNameSection...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Exercise 2.1 | ArrayList Instruction 1. Create a Java class in the _1_CS201 Your Last NameFirstNameSection project. Name the class ArrayListOfArrayElements. 2. Create a method that will handle the following operations. • Declare a variable that will dynamically accept an array size. The size and contents of the array are arbitrary. • Declare an array that accepts numerical values. • Use an appropriate iteration control structure to accept the elements of the array. 3. Create another method that will handle the following operations. • Declare a variable that will dynamically accept an array size. The size and contents of the array are arbitrary. • Declare an array that accepts String values. • Use an appropriate iteration control structure to accept the elements of the array. 4. Create another method that will copy the elements of the array of numerical values to an ArrayList. Manipulate the array elements using your choice of 10 ArrayList methods. 5. Create another method that will copy the elements of the array of String values to ArrayList. Manipulate the array elements using your choice of 10 ArrayList methods. 6. Use an appropriate iteration control structure to display the elements of the two ArrayLists. 7. Use an appropriate iteration control structure to display the elements of the two ArrayLists. LineSeparator Exercise 2.2 Stack LineSeparator Instruction 1. Create a class in _1_CS201 Your Last NameFirstNameSection. Name the class StackRunner. This class will serve as the Runner. 2. Create another class named StackClass. 3. In the StackClass, create a Stack. Name the stack StackList. 4. Create two methods. Name the first method to add and the second method result. 5. Create an ArrayList to accept 10 randomly generated numbers from 1 - 100. 6. Use the add method of the Stack to push the elements from the ArrayList. 7. In the result method, display elements that are popped from the stack. 8. Instantiate the SampleClass in the StackRunner. Use the instance of the StackClass to execute the methods of the stack. 9. Run the program LineSeparator Exercise 2.1 | ArrayList Instruction 1. Create a Java class in the _1_CS201 Your Last NameFirstNameSection project. Name the class ArrayListOfArrayElements. 2. Create a method that will handle the following operations. • Declare a variable that will dynamically accept an array size. The size and contents of the array are arbitrary. • Declare an array that accepts numerical values. • Use an appropriate iteration control structure to accept the elements of the array. 3. Create another method that will handle the following operations. • Declare a variable that will dynamically accept an array size. The size and contents of the array are arbitrary. • Declare an array that accepts String values. • Use an appropriate iteration control structure to accept the elements of the array. 4. Create another method that will copy the elements of the array of numerical values to an ArrayList. Manipulate the array elements using your choice of 10 ArrayList methods. 5. Create another method that will copy the elements of the array of String values to ArrayList. Manipulate the array elements using your choice of 10 ArrayList methods. 6. Use an appropriate iteration control structure to display the elements of the two ArrayLists. 7. Use an appropriate iteration control structure to display the elements of the two ArrayLists. LineSeparator Exercise 2.2 Stack LineSeparator Instruction 1. Create a class in _1_CS201 Your Last NameFirstNameSection. Name the class StackRunner. This class will serve as the Runner. 2. Create another class named StackClass. 3. In the StackClass, create a Stack. Name the stack StackList. 4. Create two methods. Name the first method to add and the second method result. 5. Create an ArrayList to accept 10 randomly generated numbers from 1 - 100. 6. Use the add method of the Stack to push the elements from the ArrayList. 7. In the result method, display elements that are popped from the stack. 8. Instantiate the SampleClass in the StackRunner. Use the instance of the StackClass to execute the methods of the stack. 9. Run the program LineSeparator
Expert Answer:
Answer rating: 100% (QA)
Exercise 21 ArrayList java import javautilArrayList import javautilScanner public class ArrayListOfArrayElements public static void mainString args Ar... View the full answer
Related Book For
Data Modeling and Database Design
ISBN: 978-1285085258
2nd edition
Authors: Narayan S. Umanath, Richard W. Scammel
Posted Date:
Students also viewed these programming questions
-
According to the Americans with Disabilities Act, a ramp cannot have an incline that is greater than 5. The regulations also state that the maximum rise of a ramp is 30 inches. When a ramp needs to...
-
Design a Java class that represents a cache with a fixed size. It should support operations like add, retrieve, and remove, and it should evict the least recently used item when it reaches capacity.
-
The tasks must you complete as part of building the subledger applications while implementing Oracle Accounting Hub Cloud? Explain.
-
1. Explain how Domino's strategy differed from its competitors. 2. Has the firm been able to achieve a long-term strategic fit between its strategy and HR practices in your opinion? Why or why not?...
-
Draw a UML sequence diagram that shows a DMA bus transaction and concurrent processing on the CPU.
-
What are the various types of chain drive? Explain with neat sketches.
-
Victoria Berridge, Robert Cook, Robert Walsh, and the pilot, Scott Cowan, boarded a Twin Otter airplane for a skydiving expedition. Shortly after takeoff, the right engine failed, and the airplane...
-
Question 3 i. In the evaluation of construction companies financial statements the gearing ratio and liquidity ratio have been described as providing useful information on company's activities. What...
-
5.7 kg/s of saturated water steam enters a compressor with a pressure equal to 100 kPa and leaves it at a pressure equal 2.5 MPa and enthalpy equal to 3009.6 kJ/kg . The thermal losses towards the...
-
When the Concepcions went to AT&T to get a phone, they were confused as to why they were paying money for the phone when it was advertised as being free. They had to pay sales tax on the full normal...
-
In 2016, a hacker tricked a Lamps Plus employee into disclosing the tax information of approximately 1,300 other employees, resulting in the filing of a fraudulent income tax return of Lamps Plus...
-
1. Identify an entrepreneur in your area you would like to interview. 2. Contact the person you have selected and make an appointment. Be sure to explain why you want the appointment and to give a...
-
Make decisions in the situations described in the Ethical Behavior Worksheet. You will not have all the background information on each situation; instead, you should make whatever assumptions you...
-
The following scenarios describe situations faced by hypothetical companies that currently have a centralized organization structure. As you review each of the scenarios, provide your opinion as to...
-
Consider the beam shown in (Figure 1). Suppose that d = 3.1 m Figure - (Gr') kN/m
-
A fast-food restaurant averages 150 customers per hour. The average processing time per customer is 90 seconds. a. Determine how many cash registers the restaurant should have if it wishes to...
-
How are multi-valued dependencies incorporated into the definition of fourth normal form (4NF)?
-
Display the total number of pounds of milk produced in each region during the 2006-2010 time period?
-
This exercise is based on the three Presentation Layer ER diagrams that follow. a. Describe what is reflected by the entity types and relationship types in Presentation Layer ER diagram number 1. In...
-
If the VIN3 gene had a loss-of-function mutation, how do you think that would affect the phenotypes of summer-annual and winter-annual Arabidopsis plants? a. Neither type would flower. b. Both types...
-
Which of the following is not an important function of heterochromatin formation? a. Gene silencing b. Prevention of viral proliferation c. Splicing of pre-mRNA d. Prevention of movement of...
-
The effects of paramutation may vary with regard to a. the likelihood that the parmutagenic allele will alter the paramutable allele. b. the stability of the paramutagenic allele over the course of...
Study smarter with the SolutionInn App