Question
Code in java, please 1. Write a generic Bag class using an array to store any objects. Test the Bag class with a Demo class
Code in java, please
1. Write a generic Bag class using an array to store any objects. Test the Bag class with a Demo class to store, find, delete, and display objects of Integers and String, respectively.
2. Write another class called Student, which contains name (String), id (String), and gpa (double) fields. Modify the generic Bag class from the previous problem to store five students with automatically generated id numbers. You will then find, delete, and display any student by his/her id number.
3. Write another class called Faculty, which contains name, id, and salary fields. Modify the generic Bag class from the previous problems, if necessary, to store five faculty and five students, and then find, delete, and display either faculty or student by id number. All id numbers should be automatically generated and there should have no duplicated id values between Students and Faculty.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started