Question: Lab 2 . java Output: Barbies - - - - - - - - - - - - - - - - Everything Barbie Real

Lab2.java
Output:
Barbies
---------------
- Everything Barbie
Real Name: Margot Robbie
Gender: Female
Duty: The real world explorer
- President Barbie
Real Name: Issa Rae
Gender: Female
Duty: Elected president of Barbie Land
- Diplomat Barbie
Real Name: Nichola Coughlan
Gender: Female
Duty: The diplomat of the group
- Journalist Barbie
Real Name: Ritu Arya
Gender: Female
Duty: Pulitzer Prize-winning journalist
- Lawyer Barbie
Real Name: Sharon Rooney
Gender: Female
Duty: Making sure every other Barbie has proper representation
- Doctor Barbie
Real Name: Hari Nef
Gender: Female
Duty: The resident physician in Barbie Land
- Gymnast Barbie
Real Name: Kate McKinnon
Gender: Female
Duty: Chopped hair and drawn-on face and legs always in the splits
- Physicist Barbie
Real Name: Emma Mackey
Gender: Female
Duty: A scientist
- Mermaid Barbie
Real Name: Dua Lipa
Gender: Female
Duty: Rocks blue hair and lives in the ocean with Merman Ken
Kens
---------------
- Just Ken
Real Name: Ryan Gosling
Gender: Male
Duty: Being in love with everything Barbie
- Also Ken
Real Name: Kingsley Ben-Adir
Gender: Male
Duty: Just another Ken in Barbie Land
- Another Ken
Real Name: Ncuti Gatwa
Gender: Male
Duty: Looking like an American cowboy Ken
- Rival Ken
Real Name: Simu Liu
Gender: Male
Duty: Not just any other Ken but Gosling's Barbie Land rival Ken
- Ken again
Real Name: Scott Evans
Gender: Male
Duty: Clueless Ken but having a great time
Character.java
This class will represent a Character object, which we will define as having:
characterName, represented as a String
actorName, represented as a String
gender, represented as a String
duty, represented as a String
A constructor with a parameter for each of the above data and initialize all fields.
A toString() method to print out the Character's information
This class should provide getters and setters.
ProductCollection.java
This class will represent a ProductCollection object and we will define it as having:
productCollectionName, represented as a String
characters, represented as an ArrayList of Character
A constructor that takes in a String productCollectionName
A method loadCharacters(String fileName), where the input parameter is the name of a file that holds the data of all the characters on that product collection. You will need to open the given file, read the contents of the file, parse (i.e., split) the data (which is comma-delimited), use that data to create a Character object, and then add that Character Object to the ArrayList.
At the end of this method declaration, add the keywords "throws IOException" - this will handle any exceptions encountered by the file reading code (by throwing them to our provided main method).
A toString() method which returns a String representation of all the Characters in the ProductCollection ArrayList
This class should provide getters and setters.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!