Answered step by step
Verified Expert Solution
Link Copied!

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.

image text in transcribed

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

The Manga Guide To Databases

Authors: Mana Takahashi, Shoko Azuma, Co Ltd Trend

1st Edition

1593271905, 978-1593271909

More Books

Students also viewed these Databases questions

Question

18. If you have power, then people will dislike and fear you.

Answered: 1 week ago