Your assignment is to take Assignment 1 and modify it with methods that:
1.Calculate the number of bills required for the denomination.
a.The method will have two integer parameters: the remaining amount
and the denomination
b.The method will return an integer value that is number of bills for the
given denomination
2.Calculate the remainder.
a.The method will have two integer parameters: the remaining amount
and the denomination
b.The method will return an integer value that is the remaining amount for
the given denomination
3.Print to the console both of the values calculated in previous two methods.
a.The method will have two integer parameters: the remaining amount
and the denomination
b.The method will use a switch statement to determine which output
statement to use for each denomination
c. The method will be of type void
4.In addition, you will create a method that checks if sufficient bills of each
denomination are present in the ATM to meet the quantity needed to dispense
the correct amount.
a.The following variables will be added to the program and used by the
method:
int numHundredsAvailable = 5;
int numFiftiesAvailable = 5;
int numTwentiesAvailable = 5;
int numTensAvailable = 5;
int numFivesAvailable = 5;
int numTwosAvailable = 5;
int numOnesAvailable = 5;
b.The method will have three integer parameters: the remaining amount,
the denomination, and the number of bills for a give denomination
available in the ATM. (The variables in 4.a will be passed in for the
third parameter)
c. Once it has been determined that a sufficient number of bills are present
for the transaction to take place, the number will of bills to be
dispensed will be debited from number of bills available. If an
insufficient number of bills are present then an error message should
be output and the program terminated.
d.A message will then be output to indicate the number of bills remaining
for the given denomination.
e.The method will be of type Boolean and return true if a sufficient
number of bills are present for the transaction and false otherwise.
5.Create flow charts for each of the methods and the programâ€™s main.
The program I have to add it to is already written:
I will attach it below.
I have also attached the assignment instructions, elaborating on what I already wrote
Attachments
Tags
Clarifications
/* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */
var disqus_shortname = 'cramshark'; // required: replace example with your forum shortname
var disqus_identifier = '/production/1756';
/* * * DON'T EDIT BELOW THIS LINE * * */
(function () {
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
})();
Please enable JavaScript to view the comments powered by Disqus.