StudentShare solutions
Triangle menu

Java Program ShopKeeper - Essay Example

Not dowloaded yet

Extract of sample
Java Program ShopKeeper

Some utility methods like getStockValue() and getNeededItems() are also there to return the over all value of the stock and the list of needed items respectively.
3. ShopKeeper class: This class gives the overall graphical user interface to the client so that the client can access both StockTake and Item classes in order to manipulate Items. This class uses some more user-defined classes to construct the GUI. The classes are:
a. ShopKeeperDesktopManager class: This class helps to create multiple document interface environment.
b. InsertItemFrame class: This class makes a child window for insert Item information.
c. NeededItemFrame class: This class makes a child window for displaying the list of needed items whose quantity is zero.
Coding
Source codes of all the classes are given along with their file names.
Item.java
import javax.swing.*;
import java.io.*;

public class Item
{
String iName;
int iQty;
double iPrice;
public Item(String iName)
{
this.iName=iName.toUpperCase();
iQty=0;
iPrice=0;
}
public Item(String iName,int iQty,double iPrice)
{
setIName(iName.toUpperCase());
setIQty(iQty);
setIPrice(iPrice);
}
public void setIName(String iName)
{
this.iName=iName.toUpperCase();
}
public String getIName()
{
return iName;
}
public void setIQty(int iQty)
{
if(iQty>=0) this.iQty=iQty;
else JOptionPane.showMessageDialog(null,"Qty cannot be -ve","Check Qty",JOptionPane.ERROR_MESSAGE);
}
public int getIQty()
{
return iQty;
}
public void setIPrice(double iPrice)
{
if(iPrice>0) this.iPrice=iPrice;
else JOptionPane.showMessageDialog(null,"Price cannot be -ve or zero","Check Price",JOptionPane.ERROR_MESSAGE);
}


public double getIPrice()
{
return iPrice;
}
public double getValue()
{
return iPrice*iQty;
}
public String toString()
{
return "[Item: "+iName+";Price: "+iPrice+";Quantity: "+iQty+";Value: "+getValue()+"]";
}
}

StockTake.java
public class StockTake
{
Item itemsArray[];
int arrSize;
int itemCount;
public StockTake(int arrSize)
{
if(arrSize>0)
{
itemsArray=new Item[arrSize];
this.arrSize=arrSize;
this.itemCount=0;
}
else
{
itemsArray=new Item[50];
this.arrSize=50;
this.itemCount=0;
}
}
public Item[] getItemsArray()
{
return itemsArray;
}
public boolean addItem(Item i)
{
if(itemCount ...Show more

Summary

This java project is made by using Java2SDK 1.4.2 but the program can be interpreted by any version of J2SDK from 1.2 to higher. The project contains following classes, which are described briefly along with their functionality.
1. Item class: This class is capable of holding item name, quantity, price and have setter setter and getter methods for storing and retrieving correct data in these instance variables…
Author : millermay
Java Program ShopKeeper essay example
Read Text Preview
Save Your Time for More Important Things
Let us write or edit the essay on your topic
"Java Program ShopKeeper"
with a personal 20% discount.
Grab the best paper

Related Essays

Java programs
2 pages (500 words) Essay
Java Game Programming, any future
In a study conducted in US, it was found that more than 50 percentages of the developers prefer Java in developing applications and this figure is constantly rising. There are several reasons that could be cited for this advancement. Java is a widely used language due to its numerous advantages.
15 pages (3750 words) Essay
Java Programming
In the line no 28, I have defined a class which is the basis of encapsulation in JAVA. Encapsulation is the mechanism that binds together code and the data it manipulates, and keeps both safe from outside interference and misuse. As we look at the line no 28 we find the syntax of the class as
6 pages (1500 words) Essay
Java Programming Essay
The first objective of the task thus is in creating an object that is composite with some shapes available. The next objective is to enhance the code so that many composite objects can be included efficiently in terms of time and space. The last objective is to demonstrate the animation capabilities available through the package.
4 pages (1000 words) Essay
Java applets and JavaScript scripts
An applet is a java program that must be run from another program, which is acknowledged as its host program. Normally, web browsers such as Netscape’s Communicator or Microsoft Internet Explorer are used to run the applets. The expression
3 pages (750 words) Essay
Java zone
The writer liked coffee, making him curious of what goes in the major plantations. The original habitat of coffee was in Ethiopia but since Nicaragua and other countries shares some similar conditions with
1 pages (250 words) Essay
Java programing
These data elements are modeled as classes and they are active entities that can manipulate the data contained in themselves and in other classes. Finally, the system behavior is modeled after the interactions of these data items
1 pages (250 words) Essay
Java Card
The high connectivity that makes the world a global village has resulted in spontaneous emergence of electronic businesses which have opened up new avenues of commerce and access to a wider market. Technologies such as the smart card have significantly
11 pages (2750 words) Essay
Java Technology
It was first known as oak, then Green and later Java, which was after the coffee that was consumed in bulk while in the process of developing the language. Gosling, Sheridan, and Naughton were the developers and required implementing a language that was similar
3 pages (750 words) Essay
Java PROGRAMMING
Object programming on the other hand refers to a programming technique that is founded on the aspects of data structures which imbibe the data (Hughes, 2009). It is important to note and record that the data exist in
1 pages (250 words) Essay
Get a custom paper written
by a pro under your requirements!
Win a special DISCOUNT!
Put in your e-mail and click the button with your lucky finger
Your email
YOUR PRIZE:
Apply my DISCOUNT
Comments (0)
Rate this paper:
Thank you! Your comment has been sent and will be posted after moderation