Concepts: Arrays, Objects, Interfaces, Generics
Create a class. Write a method in Java that takes as arguments an array and another value. The method returns the position (index) of the value in the array. For example, given an array {2, 4, 6, 8} and value 6, the routine should return 2 (since 6 occurs at position 2 in the array (what is the first index in a Java array?)).
Your method should use generic parameters so that arrays and values of various types can be passed in, although any single method call will pass in an array and a value of the same type. Write your method to be as flexible as possible in other ways as well; e.g. do not hard-code the length of the array that is passed in.
This method does not output anything to the screen.
From a separate class, call your method from main anddemonstrate it working with arrays of at least three different types. The results of the method calls should be printed to the screen from here in main.
Problem #2
Concepts: Java Collections (Linked Lists and Queues), integrating with an existing codebase
Concerts are back, and new concert tickets are available! You need to enter the names of the people waiting to buy tickets in order to form a line. However, you will later find out that a couple of people are not eligible to buy tickets because they are scalpers rather than actual concert goers. You will have to remove those people from the line. Additionally, a special raffle will be held and the winner of the raffle will be inserted at the front of the line. You will have to issue tickets to the first 10 people in line, but there are 15 people total in line. Anyone not in the top ten will be put on a waiting list for the next available ticket.
Implementation requirements:Create a new class. Use a LinkedList to create the main line and a Queue to create the waitlist. Usethis test harnessto guide the creation of your class. In other words, examine the test harness - it will inform your design decisions as you create your class; your class has to work when the test harness runs!Don't change the test harness - I'll run it as-is on my end and it needs to be able to interact with your class.Make assumptions as required and let me know if you have any questions.
Test Harness:
ConcertTicketsTest.java
Submission Requirements
Please submit:
- All source code that you write. This will probably be several Java classes (.javaextensions).
- Screenshots of your programs running on your workstation. This will probably be several image files (.jpeg,.png, or similar).
You don't need to submit the test harness.