Answered step by step
Verified Expert Solution
Question
1 Approved Answer
using java how do I create a Class that implements the following: This class is called Alchemist Has Variables: name, magicPoints, rank, and village name
using java how do I create a Class that implements the following:
This class is called Alchemist
Has Variables: name, magicPoints, rank, and village
name is the name of the person
magicPoints will be a number that represents a resource for using alchemy, it can be an int
rank is what rank they are in the alchemist millitary, this can be a string
village is the name of the village they were born in
Create constructors, default and that sets the values of all variables based on parameers. Ensure that the default constructor sets the variables to some default value you can choose what that means
Ensure that the class is well encapsulated remember what we need to do in order to encapsulate our class
Make a Method called Transmute, this method will take a parameter of a string
It will check if the character has or more magicPoints
If they do it will print out that they transmuted whatever the parameter was into a Phillosopher's stone. It will then subtract from their magicPoints They spent this to do the spell
ie if i did bob.transmuteLead and bob had more than magic points available, it would print "Bob transmuted the Lead into a Philosopher's Stone. The law of equivalent exchange has been met.".
If they don't have enough points available, provide a message that explains that they do not have enough points to do the move.
Make an overloaded method of transmute. This one will take no parameters
If they try to use this method, It should just print "The law of Alchemy is Equivalent Exchange. You make a Philosopher's stone without sacrificing something else".
It should do nothing else
Create method of your choice that allows the alchemist to cast a spell.
You have full liberty to make this do whatever you want
Good things to include might be print statements, calculations with the variables in the class, or using parameters to make the method more interesting
Create a demo class to show off your Alchemist class.
Create an array of Alchemists.
Make sure you instantiate them using the constructors you have made.
Give them all different values for their instance variables
Using a for each loop, have each alchemist use their transmute method. Have them all try to transmute "A Person" into a philosopher's stone.
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