Page 1 of 1

C++ Language Please Write a program that implements four classes: NPC, Flying, Walking, and Generic for a fantasy rolepl

Posted: Wed Apr 27, 2022 3:07 pm
by answerhappygod
C++ Language Please
Write a program that implements four classes: NPC, Flying,
Walking, and Generic for a fantasy roleplaying game. Each
class should have the following attributes and methods:
Demonstrate the classes in a program that has an array of NPC
pointers. The array elements should be assigned the addresses of
dynamically allocated Flying, Walking, and Generic objects. The
program should then traverse the array, calling each object's
printStats() method. Assign whatever values you wish to the
attributes.
Implement your classes using the following UML diagram. Do no
use global variables. Ensure there are no memory leaks. Use only
what we've covered in the course to write your solution.
Classes have to be implemented using Uml design and This is
required output of program
C Language Please Write A Program That Implements Four Classes Npc Flying Walking And Generic For A Fantasy Rolepl 1
C Language Please Write A Program That Implements Four Classes Npc Flying Walking And Generic For A Fantasy Rolepl 1 (123.1 KiB) Viewed 21 times
NPC -name: string +NPCO: +NPC(n: string) +setName(n:string): void +getName(): string +printStats():void Flying -flightSpeed: int +Flying +setFlightSpeed(fs : int) : void +getFlightSpeed(): int +printStats(): void Walking -walkSpeed: int +Walking(): setWalkSpeed(ws : int) : void +getWalkSpeed(): int +printStats(): void Generic -stat: int +Generici): +Generican :string, s: int): setStat(s : int) : void +getstat(): int +printStats(): void A 50-Point Sample Run: Name: Flying Flight Speed: 12 Flying Monster. Name: Walking Walking Speed: 8 Walking Monster. Name: Tom Bombadil Generic Stat: 9001 Generic Monster.