# Thread: help with this coding

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
{
...
}

// 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 ...
{
...
}
}

2. ## Re: help with this coding

Go through the Forum Rules, especially the third paragraph; also go through http://www.java-forums.org/forum-gui...w-members.html 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?

db

3. Member
Join Date
May 2012
Posts
18
Rep Power
0

## Re: help with this coding

I assume the "question" is "Please complete the methods for me". Not how it works.

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•