Question: I need the pseudocode for this. The source code is in Java. // Change class public class Change { // store user's name and coin
I need the pseudocode for this. The source code is in Java.
// Change class
public class Change { // store user's name and coin change amount private String name; private int coinAmount;
// constructor for Change class with parameter public Change(String name, int coinChangeAmount) { this.name = name; this.coinAmount = coinChangeAmount; }
// Using getter method to get user's name public String getName() { return name; }
// Using getter method to get coin change amount public int getCoinChangeAmount() { return coinAmount; }
// Using setter method to set user's name public void setName(String name) { this.name = name; }
// Using setter method to set coin change amount public void setAmount(int amount) { this.coinAmount = amount; }
// To calculate & return the denomination type and count public int[] coinchangecalculate() { // calculate the number of fifty cents int fiftyCent = coinAmount / 50; // calculate the number of twenty cents int twentyCent = (coinAmount % 50) / 20; // calculate the number of ten cents int tenCent = ((coinAmount % 50) % 20) / 10; // calculate the number of five cents int fiveCent = (((coinAmount % 50) % 20) % 10) / 5;
int denominations[] = {fiftyCent, twentyCent, tenCent, fiveCent}; return denominations; } }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
