Answer to Question #213636 in Java | JSP | JSF for Karon Aldrich

Question #213636

1) Implement an object oriented ’Character’ class to capture the common attributes and actions of all characters in your game. No need to make this class or the subclass public.

2) Declare two data fields for attributes of the character, one textual and one numeric.

3) Implement a constructor method to initialize data fields and set up the character object .

4) Since all characters can attack, implement a method to simulate the character object attacking in some generic way, including informative printouts


1
Expert's answer
2021-07-05T01:07:22-0400
public class Main
{
	public static void main(String[] args) {
		Character c=new Character();
		c.print();
	}
}


class Character{
    private String text;
    private int num;
    Character(){
        text="";
        num=0;
    }
    void print(){
        System.out.println("Text is:"+text);
        System.out.println("Num is:"+num);
    }
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS