Question
JAVA: let us continue our story with our young knight of the round table. Being a knight isnt easy battle here, battle there and from
JAVA:
let us continue our story with our young knight of the round table. Being a knight isnt easy battle here, battle there and from the looks of things, theres going to be quite a few battles in the very near future, so in order to maintain sanity and relax, our valiant knight enjoys lying out in the fields at night enjoying the stars.
Notice that there was mention of future battles. Soooo, battles. Lets see. Its a bit difficult to fight with yourself (well assume that our knight is not schizophrenic), so this means that we will be dealing with multiple knights in the near future, right? Now bears the question do we want to rewrite the same code over and over that maintains the attributes of our knight? Of course not and this is where we start creating classes from which well instantiate our knight (and other) objects.
Acceptance Criteria: 1. Youll need public classes: public class Knight public class Stars 2. Youll need to create a driver class which will contain your main method: public class KnightDriver 3. We need the ability to enter the Knights attributes (name, health, number of battles, age, and amount of gold procured from pillaging) using the constructor from class Knight. 4. Instance variables must be accessed via set and get methods. 5. Command line interaction is boring, so well need to spice things up with Dialog boxes utilizing the javax.swing package for our input. 6. Youll need 7 input dialog boxes. Five for the knights attributes. Two for the number of starts (rows & columns) that the knight will be viewing. 7. Notice in the sample output that the stars are not blocked, this is how your output should be as well. 8. The output can be via the command line or if youd like to get fancy, via a dialog box. 10. files to create KnightDriver.java, Knight.java & Stars.java files.
Sample Output:
Knight Name: Sir Jav-a-lot Knight Health: 12 Knight Battles: 6 Knight Age: 25 Knight Gold: $100
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
Step 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