Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

17 THE SPECIAL SUM PROBLEM Write a method named specialSum. Return the sum of the three int arguments, a, b and c. What's the catch?

image text in transcribed

17 THE SPECIAL SUM PROBLEM Write a method named specialSum. Return the sum of the three int arguments, a, b and c. What's the catch? If any of the values is a teen-in the range 13..19 inclusive- then that value counts as 0, except 15 and 16 do not count as a teens. (You may write a separate helper method to determine that, if you like.) input of 1, 2, 3 6 . input of 2, 13, 13 input of 2, 1, 143 18 THE SPECIAL SUM PROBLEM Write a method named specialSum. Return the sum of the rounded values of three int arguments, a, b and c. We'll round an int value up to the next multiple of 10 if its rightmost digit is 5 or more, so 15 rounds up to 20. Alternately, round down to the previous multiple of 10 if its rightmost digit is less than 5, so 12 rounds down to 10. To avoid code repetition, you may write a separate helper method but that is not required. . input of 16, 17, 18 60 input of 12, 13, 14 30 // note, 16-.20 + 17->20 + 18->20-) 60 // note, 12->10 + 13-)10 + 14-10-) 30 input of 6, 4, 4 10 I note, 6-10 4-0 4-0 -10 19 THe BLACKJACK PROBLEM Write a method named blackJack that is given 2 int values, both of which are greater than 0. Your method should return whichever value is nearest to 21 without going over. Return O if they both go over. input of 19, 21 21 input of 21, 19 21 input of 19, 22 19

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

Students also viewed these Databases questions

Question

Use the quark model to describe the reaction p + n + 0.

Answered: 1 week ago