Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Class Name: KeepTheChange Method Signature: static float getAmount(float amount) Given a Number the objective is to keep the change (the coin portion only to the
Class Name: KeepTheChange Method Signature: static float getAmount(float amount) Given a Number the objective is to keep the change (the coin portion only to the next dollar). See Table below for examples Example of your code in action float change = KeepTheChange.getAmount(63.21f) Example package com.learning.servlets; import com.learning.service. KeepTheChange; public class DriverKeepTheChange 1 public static void main(String[] args) { Given 14.00 63.21 63.82 11.85 26.54 13.03 69.76 94.77 18.69 72.46 96.06 54.18 55.32 67.25 32.49 98.24 39.87 47.58 float() numbers = { 63.21f, 63.82f, 11.85f, 26.54f, 13.03f, 69.76f, 94.77f, 18.69f, 72.46f, 96.66f, 54.18f, 55.32f, 67.25f, 32.49f, 98.247, 39.87f, 47.58f, 76.23f, 67.32f, 42.81f, 68.72f, 78.34f Keep the change 0.00 0.79 0.18 0.15 0.46 0.97 0.24 0.23 0.31 0.54 0.94 0.82 0.68 0.75 0.51 0.76 0.13 0.42 0.77 0.68 0.99 0.28 n66 for (float amountPaid : numbers) { float change -KeepTheChange.getAmount (amount Paid); System.out.format("amountPaid: %s, change: %s ", amountPaid, change); 76.23 67.32 42.01 68.72 7R 34
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started