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