Create a program with the 3 following classes. Use separate header and source files for each class.Make all of the class members public.Player• name - char[32]• x, y - floats• sword - Sword *• hit points – int• max hit points - int• Player() - default constructor• Player(char * ) - constructor that sets the name• heal(Flask *) - heals the player if the their health is low and the flask passed in hascharges. Do not over heal the player.• display() - prints the name, sword name and current hit points of the playerSword• name - char[32]• damage - int• attack speed - float• Sword() default• Sword(char *) set the nameFlask• name - char[32]• charges (remaining) - int• health restored per charge - int• Flask()In main create an instance of the Player class and 3 objects from the Sword class. All of these objectsmust be created on the heap by using the new keyword. Give the swords different names, damage andattack speed values. Equip the player with one of the swords by assigning one of the Sword objects tothe player’s Sword pointer. Set the player’s hit points to half of the maximum value.Call display() on the player.Create an object from the Flask class. Use this on the player by calling the heal() function. From main()print out the remaining number of charges on the flask and the player’s hit points to verify the flaskhealed the player.Free up the memory for all of the objects before closing the program.Label all of the output. Keep the output clean and professional. You may add additional functions suchas setName() if you wish. Use a few comments throughout the code to explain your work. Submit yourproject as specified.
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here