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.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
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
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education