Module 2 Lab - Enhancing the GameCharacter Demo
Objective
Enhance User Interaction: Add new features to the existing
Driver
class that allow users to modify the game character's name and weapon through menu options.
Background:
You have been provided with a basic game character management system that allows users to create a character and modify its health. Your task is to extend this functionality to allow users to change the character's name and weapon.
Requirements:
Menu Options: Add two new options to the menu:
Change the character's name.
Change the character's weapon.
Implementation:
When a user selects to change the name or weapon, prompt them for a new value and update the character's attribute accordingly.
After any change, the updated state of the character should be displayed.
Instructions:
Setup: Begin with the provided Java Demo → Wrapping it all Up - Module 2. Please make sure you have a working environment in which to compile and run Java programs.
Modify the Menu:
Extend the existing menu with two additional choices:
4) Change Character Name 5) Change Character Weapon
Ensure that the menu repeatedly displays until the user chooses to exit the program.
Implement Name and Weapon Changes:
For changing the name:
Prompt the user to enter a new name.
Update the character’s name using the
setName
method of theGameCharacter
class.
For changing the weapon:
Prompt the user to enter a new weapon.
Update the character’s weapon using the
setWeapon
method.
Testing:
Test the program to ensure that the user can change the name and weapon multiple times and that these changes are reflected when the character's information is displayed.
Submission:
Submit your modified
Driver.java
file.Include screenshots or a detailed description of your test cases and the outputs.
Evaluation Criteria:
Functionality: The program runs as specified without crashes or bugs.
Code Quality: Code is well-organized and comments are used to enhance readability.
User Experience: Changes in the menu are intuitive and the program prompts are clear.
Deliverables
Upload the following files in a zip folder that you have created:
Java code files (2 files - the Pet and your driver file)
Screenshot of the Console with the code executing
COSC-1437 / ITSE-2457 Computer Science Dept. - Author: Dr. Kevin Roark