The Beholder class in Java is a blueprint for creating instances of Beholders Beholder Class in Java Introduction
Objectives/Purpose The Beholder class in Java is a blueprint for creating instances of Beholders, fictional creatures from the Dungeons & Dragons universe. The class is designed to serve as a blueprint for the definition and manipulation of various attributes, such as the Beholder's name, color, and abilities.
Background Beholders are fascinating magical entities endowed with numerous eye stalks, each with a unique power. This Java class was made to highlight the essential characteristics and abilities of Beholders in a reusable object-oriented format.
Methodology Inputs name: Name of the Beholder (String) radius: Physical size (double) color: Skin color (String) eyeColor: Eye color (String) teeth: Type of teeth (String) numEyeStalks: Number of eye stalks (int)
Outputs Printed Beholder attributes Text displaying abilities Beholder attributes are initialized through one of three constructors. Getters and setters allow manipulation of these attributes. Abilities are invoked via specific methods.
Methods fireEyeBeam(String beam): Executes an eye beam attack, where beam specifies the type. (can fire various eye beams) levitate(): Makes the Beholder levitate, printing a descriptive text. Variables Private instance variables: name, radius, color, eyeColor, teeth, numEyeStalks Calculations N/A
Results
Findings The Java class successfully enables the creation and manipulation of Beholder instances with a variety of attributes. It also provides methods for executing specific abilities tied to the creature.
Significance The class captures the complexities and functionalities of a Beholder, providing a robust toolset for simulating these magical creatures in a Java environment.
Conclusions What Was Learned The project was a hands-on experience in object-oriented programming, it focused on encapsulation, inheritance, and the creation of versatile constructors in Java. This project was instrumental in learning about default constructors.
Recommendations Future updates may include:
Adding more abilities to the Beholder Developing subclasses for specific types of Beholders error checks or validation mechanisms Calculations such as hit points, ability scores, and ability modifiers