Answered step by step
Verified Expert Solution
Question
1 Approved Answer
In this project, you need to form an alliance for a quest that consists of 6 people from 2 different races as Wizard and Elf.
In this project, you need to form an alliance for a quest that consists of 6 people from 2 different races as Wizard and Elf. You will implement a Java class for each race and you will define a separate class Quest (driver class) that contains a main method to test the other classes. The class Wizard contains the following private instance variables and public methods: You need to store the wizard's name, the wizard's age and the wizard's staffHeight. The class should contain the corresponding public set/get methods. The class should contain a public display method to print out the information about the Wizard object (instance). The method returns no value. The class should contain another method called castSpell to calculate and print out the power of a spell casted by the wizard. The method returns no value. The the wizard's age formula of the power calculation is the following: e staffHeight The class Elf contains the following private instance variables and public methods: You need to store the elf's name, the elf's age and the elf's bowLength. The class should contain the corresponding public set/get methods. The class should contain a public display method to print out the information about the Elf object (instance). The method returns no value. The class should contain another method called shootArrow to calculate and print out the power of an arrow shot by the elf. The method returns no value. The formula of the power calculation is the following: the elf's age * bowLength In the driver class Quest, you need to use a loop to create an alliance of 6 people from different races. At least one person from each race must be selected for this alliance, the remaining people can be selected from any race by the user. (As you can understand, you need to use a decision structure (switch-case, if-else) in the loop to create the selection of races.) Create 6 people in total. For each person, set the corresponding data members, display the information and print out the power of the corresponding weapon of the person. At the end. the program must print out the number of people created from each race
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