Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

JAVA Part #1: Practice with Recursion Write a recursive method that calculates the sum of the digits in an integer. It should have this signature:

JAVA

Part #1: Practice with Recursion

Write a recursive method that calculates the sum of the digits in an integer. It should have this signature:

Public static int sumDigits(int n)

For example, sumDigits(234) returns 2 + 3 + 4 = 9. Use the main() method to ask the user to enter an integer and then call sumDigits(int).

Part #2: More Practice

Write a recursive method that calculates the number of uppercase letters in a string. The signature should be similar to part one:

Public static int countUpper(String strValue)

For example, countUpper(Hello World) returns 2. Use the main() method to ask the user to enter a string and then displays the number of capital letters in the string.

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

Database Design Application Development And Administration

Authors: Mannino Michael

5th Edition

0983332401, 978-0983332404

More Books

Students also viewed these Databases questions

Question

Connect with your audience

Answered: 1 week ago