[Solved] Programming

Question 7

Programming Write a static method named containsBothDigits that accepts three integer parameters a, b, and c. Assume that a is a positive integer (greater than 0) and that b and c are single-digit numbers from 0-9 inclusive. Your method should return true if a contains both b and c at among its digits, and false otherwise. For example, the number 433407 contains 4, 3, 0, and 7 as its unique digit values, so a call to your method of containsBothDigits(433407, 7, 3) should return true. If b and c are the same number, your method should return true if that digit appears at least once among the digits; in other words, the same digit from a could match both b and c. So for example, a call of containsBothDigits(433407, 7, 7) should return true. Note that the digit b or c might appear more than once in a, as with 433407 containing two 3s. The following table lists some additional calls to your method and their expected return values: img Note: You may not use a String to solve this problem.

10+ million students use Quizplus to study and prepare for their homework, quizzes and exams through 20m+ questions in 300k quizzes.


Explore our library and get Programming Homework Help with various study sets and a huge amount of quizzes and questions


Study sets





Upload material to get free access

Upload Now Upload Now
Upload Now

Invite a friend and get free access

Upload NowInvite a friend
Invite a friend

Subscribe and get an instant access

See our plansSee our plans
See our plans