Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Using JAVA, please and thank you! NPC Class and NPCMain Class Additions, need to be included in the program. General Description: You have been tasked
Using JAVA, please and thank you! NPC Class and NPCMain Class Additions, need to be included in the program.
General Description: You have been tasked to design an NPC class which will be used to create NPC objects for an upcoming video game. NPC stands for "non-player character" and will be used to create various random characters in the video game world. Some NPCs may tell a story when talked to, or may say random things when talked to. You are required to implement the NPC class as well as include a Main (driver, client, tester) class to test all functionality of your NPC class. Package Declaration and General Setup Place all files for this project in a package called "hwl". Deductions will be given for programs which do not follow this requirement. . Please include a multi-line comment at the top of each .java file with your name and a brief description of what that class does. - See the Triangle.java source code file for an example of this. The NPc Class: Data Fields name: A string to hold the name of the NPC. The default value is "NO NAME" race: A string to hold the race of the NPC, Races can be anything such a dragon, orc, dwart, eif, human, etc. etc. The default value is "NO RACE" XPOSA noating-point value to hold the x-coordinate of where the NPC will be placed in the world This value cannot be set to a negative number by a client The default value is-999 0 " yPos A noating-point value to hold the y-coordinate of where the NPC will be placed in the world This value cannot be set to a negative number by a client The default value is-999 0 . dialogue: An array of text holding all of the dialogue that the NPC can speak Each sentence of the NPCs dialogue shall be stored one sentence per index in the array. Some NPCs will say random things, others will tell a sequential story if the text is sequential, each sentence or the dialogue should be listed sequentially in the array starting trom index 0 The default value is a one element array with thetext "PLACEHOLDER TEXT" as the first index in the aray. See below for an example of some text has SequentialDialogue: A boolean indicating whether or not the dialogue is sequential. If so, then the dialog should be displayed in the correct sequence every time the talk) method is called. The default value is talse nextDialogue: An integer indicating the index of the next piece of dialog that will display if the NPC is spoken to. Only used it hassequentialDialogue is set to true. This value is controlled internally. The default value is 0 Constructors Include a default constructor which initializes a default NPC with the required default values for each data tield Include an additional constructor which initializes the name, race, xPos, yPos, dialogue, and hassequentialDialogue of a new NPC object. NOTE: nextDialogue is only handled intenally, should be initialized to o and should not be accessed set by an outside client. Getters General Description: You have been tasked to design an NPC class which will be used to create NPC objects for an upcoming video game. NPC stands for "non-player character" and will be used to create various random characters in the video game world. Some NPCs may tell a story when talked to, or may say random things when talked to. You are required to implement the NPC class as well as include a Main (driver, client, tester) class to test all functionality of your NPC class. Package Declaration and General Setup Place all files for this project in a package called "hwl". Deductions will be given for programs which do not follow this requirement. . Please include a multi-line comment at the top of each .java file with your name and a brief description of what that class does. - See the Triangle.java source code file for an example of this. The NPc Class: Data Fields name: A string to hold the name of the NPC. The default value is "NO NAME" race: A string to hold the race of the NPC, Races can be anything such a dragon, orc, dwart, eif, human, etc. etc. The default value is "NO RACE" XPOSA noating-point value to hold the x-coordinate of where the NPC will be placed in the world This value cannot be set to a negative number by a client The default value is-999 0 " yPos A noating-point value to hold the y-coordinate of where the NPC will be placed in the world This value cannot be set to a negative number by a client The default value is-999 0 . dialogue: An array of text holding all of the dialogue that the NPC can speak Each sentence of the NPCs dialogue shall be stored one sentence per index in the array. Some NPCs will say random things, others will tell a sequential story if the text is sequential, each sentence or the dialogue should be listed sequentially in the array starting trom index 0 The default value is a one element array with thetext "PLACEHOLDER TEXT" as the first index in the aray. See below for an example of some text has SequentialDialogue: A boolean indicating whether or not the dialogue is sequential. If so, then the dialog should be displayed in the correct sequence every time the talk) method is called. The default value is talse nextDialogue: An integer indicating the index of the next piece of dialog that will display if the NPC is spoken to. Only used it hassequentialDialogue is set to true. This value is controlled internally. The default value is 0 Constructors Include a default constructor which initializes a default NPC with the required default values for each data tield Include an additional constructor which initializes the name, race, xPos, yPos, dialogue, and hassequentialDialogue of a new NPC object. NOTE: nextDialogue is only handled intenally, should be initialized to o and should not be accessed set by an outside client. GettersStep 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