Answered step by step
Verified Expert Solution
Link Copied!

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 2 constructors, 1 default and 1 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 5 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 5 from their magicPoints (They spent this to do the spell)
i.e. if i did bob.transmute("Lead") and bob had more than 5 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 1 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 3 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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

LO5 Highlight five external recruiting sources.

Answered: 1 week ago