The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | Apr 2017 |
| Last Sign in: | 103 Weeks Ago, 3 Days Ago |
| Questions Answered: | 4870 |
| Tutorials Posted: | 4863 |
MBA IT, Mater in Science and Technology
Devry
Jul-1996 - Jul-2000
Professor
Devry University
Mar-2010 - Oct-2016
JAVA Program.
Purpose of this lab is for you to develop a program where many objects are created from a class. Primitives and objects are passed as parameters to class methods.
Problem specification Your new Wallet class implements a wallet that contains banknotes. A banknote is represented as an int for simplicity, 1 for a $1 bill, 5 for a $5 bill, and so on. You are required to use just a simple array of int to hold the banknotes. You may NOT use an array list.
Here are some example wallets printed out:
Wallet[5, 50, 10, 5] Wallet[] Wallet[1, 5, 10, 50, 5]
Here's the outline of the Wallet class. You will implement each method as described below.
Â
Â
Please open the attach file for more information .Thank you
Â
Extra credit
public Wallet removeBanknotePairs(Wallet w)
create a new wallet and add to it pairs of banknotes removed from two other wallets. Return the new wallet. For example:
Â
Â
© Anthony W. Smith, 2016CSCI 114 Programming Fundamentals IILab 4 Wallet1Lab 4 WalletPurposePurpose of this lab is for you to develop a program where many objects are created froma class.Primitives and objects are passed as parameters to class methods.Problem specificationYour newWalletclass implements a wallet that contains banknotes.A banknote isrepresented as anintfor simplicity,1for a $1 bill,5for a $5 bill, and so on.You arerequired to use just a simple array ofintto hold the banknotes.You may NOT use anarray list.Here are some example wallets printed out:Wallet[5, 50, 10, 5]Wallet[]Wallet[1, 5, 10, 50, 5]Here's the outline of theWalletclass.You will implement each method as describedbelow.public class Wallet{// max possible # of banknotes in a walletprivate static final int MAX = 10;private int contents[];private int count;// number of banknotes stored in contents[]public Wallet(){// your code goes here}public Wallet(int a[]){// your code goes here}public String toString(){// your code goes here}public int value(){// your code goes here}
Attachments:
-----------