Google Answers Logo
View Question
 
Q: simpple piggy bank program with java ( No Answer,   0 Comments )
Question  
Subject: simpple piggy bank program with java
Category: Computers > Programming
Asked by: hafedaddy-ga
List Price: $50.00
Posted: 30 Oct 2006 21:39 PST
Expires: 31 Oct 2006 22:13 PST
Question ID: 778686
This penny-jar piggy-bank program will allow a user to add or subtract
pennies or nickels, and tell the user the total amount of pennies and
nickels in the jar. Fill in all of the necessary code to make these
methods work.

// A class to build and operate a penny jar.

// Create instance data variables. They will be private instance variables
// They will be accessible only through methods in the PennyJar class
// They will be int
// Their names will be pennies and nickels
// =================================================================

public class PennyJar 
{
your code here
// =================================================================
// A constructor for the class. 
// This constructor initializes the number of pennies in the jar to
the value of the parameter, p.
// What will we need to do to achieve this?

public PennyJar (your code here) 
{
your code here
}
// =================================================================
// This method adds p pennies to the total amount stored in the jar.
// What will we need to do to achieve this?

public void addPenny (your code here)
{
your if-then-else code here
{
// =================================================================
// This method removes p pennies from the total amount stored in the jar
// What will we need to do to achieve this?
// How will we handle error messages?

public void takePenny (your code here) 
{
your if-then-else code here
}
// =================================================================
// This method adds n nickels to the total amount stored in the jar.
// What will we need to do to achieve this?

public void addNickel (your code here)
{
your if-then-else code here
{
// =================================================================
// This method removes n nickels from the total amount stored in the jar
// What will we need to do to achieve this?
// How will we handle error messages?

public void takeNickel (your code here)
{
your if-then-else code here
}
// =================================================================
// This method returns the total number of pennies and nickels stored in the jar.
// What will we need to return?

public int total (your code here)
{
your if-then-else code here

return your code here
}
// =================================================================
} // End PennyJar

Clarification of Question by hafedaddy-ga on 31 Oct 2006 11:56 PST
need to create a simple piggy-bank program. The program must be able
to create a penny-jar piggy bank with "p" pennies and ?n?  nickels in
it (0 or any positive integer). From then on one can only add or
subtract pennies or nickels to/from it.
Answer  
There is no answer at this time.

Comments  
There are no comments at this time.

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy