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
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.
C++ Language Please Write a program that implements four classes: NPC, Flying, Walking, and Generic for a fantasy rolepl
-
answerhappygod
- Site Admin
- Posts: 899604
- Joined: Mon Aug 02, 2021 8:13 am
C++ Language Please Write a program that implements four classes: NPC, Flying, Walking, and Generic for a fantasy rolepl
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!