Question: Can someone help me with this JAVA program? Please note that we do not need to create a Shield class. As we are doing this

Can someone help me with this JAVA program?
Please note that we do not need to create a Shield class.
As we are doing this is in a software called Codio..
So the class is already set by default.
We just need to write the main class.
Please help!  Can someone help me with this JAVA program? Please note that
we do not need to create a Shield class. As we are

Directions and example You are working for a game development company on a new project. Another developer on your team has developed a Shield class. The Shield class has the following fields and methods: private String name private int protection private boolean isDestroyed public Shield(String name)-constructor that initializes the Shield's name to the value passed in to the method and sets protection to 100 and isDestroyed to false public Shield (String name, int protection) -constructor that initializes the Shield's name and protection to the values passed in to the method and sets isDestroyed to false public void repairif isDestroyed is false, this method resets the protection level to 100; otherwise, it has no effect public void defend(int amount) - decreases the Shield's protection by the amount; the lowest this value can be is zero (i.e. if the shield's protection is at 5 and it defends against 10 damage, then the new protection value should be 0, not -5). If the value hits zero, set is Destroyed to false. public boolean isDestroyed) otherwise returns true if the Shield's isDestoryed value is true and false public String get Name)- returns the Shield's name public String tostring)-displays the Shield's name and protection Your task is to use this class to create two shield objects and perform the following operations on them: Prompt the user for a name and create a shield with that name. Shield names must not have spaces (i.e use the Scanner class's next method, rather than nextLine, to read in the name) Prompt the user for a second name and a protection value and create a Shield with those values Use System.out.printin to display both shields, i.e. if your first Shield object is called shield1, you would call System.out.println(shield1) -this automatically calls the Shield object's toString method

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!