Question: Create a class that will contain at least one public method that looks like this: public int[] payCalc(double amt) If an amount is passed into

Create a class that will contain at least one public method that looks like this:

public int[] payCalc(double amt)

If an amount is passed into this method, it should return an array of integers indicating what note/coin combination is required to make up the amount indicated. The array of integers should therefore correlate with our denominations i.e. element 0 should have a number in it, indicating how many R200 notes are required, element 1 for R100 notes etc, down to the last element, indicating the number of 1c coins required.

Then create a testing program that will make an instance of the class above, and then pass different values into this method. Consider using command-line arguments so that upon each invocation of the program the payCalc() method gets passed a different amount.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

java Define a class that will contain the payCalc method public class PayCalculator Define an array of integers to store the denominations private sta... 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 Programming Questions!