Question
Goal: In this problem, you will write a class to mimic the behavior of HAL 9000 a fictional character in Arther C. Clarkes 2001: A
Goal: In this problem, you will write a class to mimic the behavior of HAL 9000 a fictional character in Arther C. Clarkes 2001: A Space Odyssey. HAL 9000 (Heuristically programmed ALgorithmic computer) is an AI (artificial intelligence) computer that controls the system of the spacecraft and interacts with the ships crew. Near the end of the film, HAL 9000 stops taking commands from the humans. In the Hal9000 class you design, HAL 9000 will respond with cordial greetings to the humans but will not complete the commands they request. A Hal9000Tester class is provided for you to verify your Hal9000 class works as expected. Instructions: Start a new BlueJ project called hw3b in the cs46a/homework/hw03 folder. In the BlueJ project, create a class called Hal9000Tester and copy the code from Codecheck. Do not change this class in any way. Next, create another class called Hal9000 (there is no starter code provided for this example). Fill in this class with the following: 1. A constructor: public Hal9000 (String crewName) Constructs a new object with the specified name of the crew member. HAL will communicate with this crew member. 2. Five methods: public String getName() Gets the name of the crew member. public String greet() Returns a string Greetings, [crew member].. For example, if the crew members name is Dave, then return Greetings, Dave. public void setName(String newName) Set a new name for the crew member. public String giveStatus() Returns a string Everything is a go, [crew member].. For example, if the crew members name is Dave, then return Everything is a go, Dave. public String executeCommand(String whatToDo) Returns a string I am sorry, [crew member]. I cant [task].. For example, if the crew members name is Dave and the task is engage drive, then return I am sorry, Dave. I cant engage drive. Other tips and guidelines: In this code, half of the points will be assigned for correct Javadocs.
Hal9000Tester:
* Tester for the Hal9000 class author version Lic class Hal9000Tester public static void main(String[] args) \{ Hal9000 hal = new Hal9000( "Dave"); Hal9000 cay = new Hal9000( "Cay"); System. out. println(hal, greet ()); System.out.println("Expected: Greetings, Dave. "); System. out.println(hal, givestatus()); System.out.println("Expected: Everything is a go, Dave."); System.out. println(hal, executeComand("engage drive")); System.out. println("Expected: I am sorry, Dave. I can't engage drive."); hal. setName ("Frank"); System. out. println(hal, greet ()); System.out.println("Expected: Greetings, Frank. "); System. out. println(hal, givestatus ()); System.out.println("Expected: Everything is a go, Frank."); System.out.println(hal executeCommand ("shut down")); System.out. println("Expected: I am sorry, Frank. I can't shut down. "); System. out. println(cay greet ()); System.out. println( "Expected: Greetings, Cay." ); System. out. println(cay givestatus ()); System.out.println("Expected: Everything is a go, Cay." ); System. out. println(cay executeCommand("engage drive")); System.out.println("Expected: I am sorry, Cay. I can't engage drive. "); \}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