Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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.
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
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