Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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... 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

Recommended Textbook for

Database Systems Design Implementation and Management

Authors: Carlos Coronel, Steven Morris

11th edition

9781305323230, 1285196147, 1305323238, 978-1285196145

More Books

Students also viewed these Programming questions

Question

Describe the DBA's responsibilities.

Answered: 1 week ago