Results 1 to 3 of 3
Thread: help with this coding
- 12-17-2012, 02:27 AM #1
Member
- Join Date
- Dec 2012
- Posts
- 1
- Rep Power
- 0
help with this coding
/*
This class implements a vendor that sells one kind of items.
A vendor carries out sales transactions.
*/
public class Vendor
{
// Fields:
private double Price = 0.0;
private int stock = 0;
private double initialMoney = 0.0;
private double money = 0.0;
private int qtySold = 0;
// Constructor
// Parameters:
// int price of a single item in cents
// int number of items to place in stock
public Vendor(double p, int s)
{
Price = p;
stock = s;
}
// Sets the quantity of items in stock.
// Parameters:
// int number of items to place in stock
// Return:
// None
... setStock ...
{
...
}
// Returns the number of items currently in stock.
// Parameters:
// None
// Return:
// int number of items currently in stock
... getStock ...
{
...
}
// Adds a specified amount (in cents) to the deposited amount.
// Parameters:
// int number of cents to add to the deposit
// Return:
// None
... addMoney ...
{
...
}
// Returns the currently deposited amount (in cents).
// Parameters:
// None
// Return:
// int number of cents in the current deposit
... getDeposit ...
{
...
}
// Implements a sale. If there are items in stock and
// the deposited amount is greater than or equal to
// the single item price, then adjusts the stock
// and calculates and sets change and returns true;
// otherwise refunds the whole deposit (moves it into change)
// and returns false.
// Parameters:
// None
// Return:
// boolean successful sale (true) or failure (false)
... makeSale ...
{
...
}
// Returns and zeroes out the amount of change (from the last
// sale or refund).
// Parameters:
// None
// Return:
// int number of cents in the current change
... getChange ...
{
...
}
}
- 12-17-2012, 02:54 AM #2
Re: help with this coding
Go through the Forum Rules, especially the third paragraph; also go through Guide For New Members and BB Code List - Java Programming Forum - Learn Java Programming.
Then edit your post accordingly. Note that to change the subject line, you will need to click "Go Advanced"
Did you have a question?
dbWhy do they call it rush hour when nothing moves? - Robin Williams
- 12-17-2012, 08:00 AM #3
Member
- Join Date
- May 2012
- Posts
- 18
- Rep Power
- 0
Similar Threads
-
Need Help Coding IO
By loopsnhoops in forum New To JavaReplies: 1Last Post: 05-18-2011, 03:44 PM -
does gui coding in netbeans is just the same with coding without nebeans?
By maizuddin35 in forum NetBeansReplies: 4Last Post: 10-25-2010, 03:49 PM -
Need help coding
By ace_03 in forum New To JavaReplies: 2Last Post: 11-25-2009, 05:16 PM -
Coding help
By Java_Fanatic in forum New To JavaReplies: 7Last Post: 10-15-2009, 04:37 AM -
Better coding
By tomiu in forum New To JavaReplies: 1Last Post: 04-09-2009, 07:19 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks