Question: Solve the following question in Java. Don't forget the second part of the question. Question 4*: [5 marks] Write a class named CapitalsCounter that implements

Solve the following question in Java. Don't forget the second part of the question.

Solve the following question in Java. Don't forget the second part of

Question 4*: [5 marks] Write a class named CapitalsCounter that implements a method named countCaps to return the number of capital letters within a String, as done in this python snippet (hint: use Character.isUpperCase(): def countCaps (s): count0 for character in s: if character.isupper ) countcount + 1 return count Write a main method to check whether or not the countCaps method correctly returns 5 when given the the string "IHaveFiveCaptialLetters". It should print":)" if successful, or "(" if failed

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!