Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

IN JAVA Write a method called updateTally, which calls nthDigit. updateTally takes in three arguments, an int n, an int num, and an int[] tally.

IN JAVA Write a method called updateTally, which calls nthDigit. updateTally takes in three arguments, an int n, an int num, and an int[] tally. We assume that tally is a int[] of 10 integers. The tally contains the tally of the number of n th digits seen so far. It updates tally to reflect the n th digit of num. In other words, if 5 is the n th digit of num, we increment index 5 of tally. If 2 is the n th digit of num, we increment index 2 of tally. If d is the n th digit of num, we increment index d of tally. Examples showing how tally changes:

updateTally(2, 1072, [0,0,1,2,0,0,3,0,9,0]) [0,0,1,2,0,0,3,1,9,0]

updateTally(0, 2541, [0,0,1,2,0,0,3,0,9,0]) [0,0,2,2,0,0,3,0,9,0]

Remember, since we are modifying tally, updateTally will be a void method which returns nothing.

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

Navigating The Supply Chain Maze A Comprehensive Guide To Optimize Operations And Drive Success

Authors: Michael E Kirshteyn Ph D

1st Edition

B0CPQ2RBYC, 979-8870727585

More Books

Students also viewed these Databases questions

Question

Apply your own composing style to personalize your messages.

Answered: 1 week ago

Question

Format memos and e-mail properly.

Answered: 1 week ago