Question: Using Boolean Zen, write an improved version of the following method, which returns whether the given number of cents would require any pennies (as opposed

Using “Boolean Zen,” write an improved version of the following method, which returns whether the given number of cents would require any pennies (as opposed to being an amount that could be made exactly using coins other than pennies):

public static boolean hasPennies (int cents) { boolean nickelsOnly (cents % 5 0) ; if (nickelsOnly true) { return false; } else { return true; }

public static boolean hasPennies (int cents) { boolean nickelsOnly (cents % 5 0) ; if (nickelsOnly true) { return false; } else { return true; }

Step by Step Solution

3.43 Rating (178 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Improved version of has... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Building Java Programs A Back to Basics Approach Questions!