Write a class called Alien. The Alien class must have one field of type String called name, one of type String called planet and one field of type boolean called humanoid. Write one constructor that takes three parameters to initialise all of these fields. The parameters must be passed in the order name, planet and humanoid status. IntelliJ hint (this won't be in the real test): put your cursor after the last field; right-click, choose Generate, choose Constructor, select the fields that are set via parameters and click Ok. Check that the constructor is correct. Write a getter method for each field. IntelliJ hint (this won't be in the real test): put your cursor after the closing curly bracket of the constructor; right click, choose Generate, choose Getter, select all of the fields; click Ok. Check that the you have three getters. Do not write setters methods. Write a method called getDetails that will return the values of the fields in one of the following two formats. For example, either: Cyberman from Mondas (humanoid) or: Cyberman from Mondas Note that "Cyberman" is just one possible value of the name field and "Mondas" is just one possible value of the planet field. If the humanoid field has the value true then the planet details must be followed by the text "(humanoid)", as in the first example above. If the humanoid field has the value false then there will be no additional text, as in the second example above. Write a class called AlienList to store a ArrayList of Alien objects. ArrayList is a class in the java.util package that acts like a list. AlienList must have a method called addAlien that takes an Alien object as a parameter and adds it to the ArrayList. AlienList must have a method called printHumanoids. This method must print out the details of all the Alien objects in the ArrayList whose humanoid field has the value true. Details of each Alien must be printed on a separate line. The print out must use exactly the format shown in part 1 of the question. Write a method in AlienList called getNonHumanoids.This method must find all Alien objects in the AlienList object’s ArrayList whose humanoid field has the value false. It must do the following things with all the matching objects: The method must remove all the matching Alien objects from the ArrayList of AlienList. It must store all matching Alien objects in a new The new ArrayList must be created as a local variable in the method, which is then returned from the method. If there are no matching Alien objects then an empty ArrayList must be returned.

Microsoft Visual C#
7th Edition
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Joyce, Farrell.
Chapter9: Using Classes And Objects
Section: Chapter Questions
Problem 11E: a. Write a FractionDemo program that instantiates several Fraction objects and demonstrates that...
icon
Related questions
Question

Write a class called Alien. The Alien class must have one field of type String called name, one of type String called planet and one field of type boolean called humanoid. Write one constructor that takes three parameters to initialise all of these fields. The parameters must be passed in the order name, planet and humanoid status. IntelliJ hint (this won't be in the real test): put your cursor after the last field; right-click, choose Generate, choose Constructor, select the fields that are set via parameters and click Ok. Check that the constructor is correct. Write a getter method for each field. IntelliJ hint (this won't be in the real test): put your cursor after the closing curly bracket of the constructor; right click, choose Generate, choose Getter, select all of the fields; click Ok. Check that the you have three getters. Do not write setters methods. Write a method called getDetails that will return the values of the fields in one of the following two formats.

For example, either:

Cyberman from Mondas (humanoid)

or:

Cyberman from Mondas

Note that "Cyberman" is just one possible value of the name field and "Mondas" is just one possible value of the planet field. If the humanoid field has the value true then the planet details must be followed by the text "(humanoid)", as in the first example above. If the humanoid field has the value false then there will be no additional text, as in the second example above. Write a class called AlienList to store a ArrayList of Alien objects. ArrayList is a class in the java.util package that acts like a list. AlienList must have a method called addAlien that takes an Alien object as a parameter and adds it to the ArrayList. AlienList must have a method called printHumanoids. This method must print out the details of all the Alien objects in the ArrayList whose humanoid field has the value true. Details of each Alien must be printed on a separate line. The print out must use exactly the format shown in part 1 of the question. Write a method in AlienList called getNonHumanoids.This method must find all Alien objects in the AlienList object’s ArrayList whose humanoid field has the value false. It must do the following things with all the matching objects: The method must remove all the matching Alien objects from the ArrayList of AlienList.

It must store all matching Alien objects in a new The new ArrayList must be created as a local variable in the method, which is then returned from the method. If there are no matching Alien objects then an empty ArrayList must be returned.

Expert Solution
steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Class
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,