p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/)
-   Java GUI (http://p2p.wrox.com/java-gui-115/)
-   -   Need help!! Example of a simple program used for business! (http://p2p.wrox.com/java-gui/86268-need-help-example-simple-program-used-business.html)

paulymonz January 9th, 2012 05:47 AM

Need help!! Example of a simple program used for business!
 
can anyone give me some examples of programs using JOption which are somehow similar to cashier register or programs used for registration of students or others. They should have the function to add, subtract, delete, update, and can be stored. I need it as an example for our module in our project proposal and project defense.. hope u can help me out..

tnx.. =>

muthukutta1 April 23rd, 2012 03:51 AM

Quote:

Originally Posted by paulymonz (Post 280157)
can anyone give me some examples of programs using JOption which are somehow similar to cashier register or programs used for registration of students or others. They should have the function to add, subtract, delete, update, and can be stored. I need it as an example for our module in our project proposal and project defense.. hope u can help me out..

tnx.. =>

Hello colleague,
Please find herewith a similartype ofyour requirements using JOption class etc that requires a little bit of modifications however to enable for the studentregistering task .(replacing InvoiceDetails with StudentDetails)
Thanks if ok
As
muthukutta1
Quote:

import javax.swing.JOptionPane;
import java.util.Formatter;

public class InvoiceWithProductApp
{
public static void main(String[] args)
{
// declare and initialize variables
String choice = "", numberStr = "", productIDStr = "",
typeStr = "", orderQuantityStr = "",outputMessage = "";
int type = 0, orderQuantity = 0;

// declare invoice object
InvoiceWithProduct anInvoice = null;

while (!(choice.equalsIgnoreCase("x")))
{
// get user input
numberStr = JOptionPane.showInputDialog("Enter invoice number: ");

productIDStr = JOptionPane.showInputDialog("Enter product ID: ");

orderQuantityStr = JOptionPane.showInputDialog("Enter order quantity: ");

orderQuantity = Integer.parseInt(orderQuantityStr);

typeStr = JOptionPane.showInputDialog(
"Enter invoice type (1=regular 2=discounted): ");
type = Integer.parseInt(typeStr);

// create Invoice object
anInvoice = new InvoiceWithProduct(numberStr, productIDStr,
orderQuantity, type);

// prepare for output
outputMessage = String.format
( "Invoice number: %s\nInvoice date: %tD\nProduct ID: %s\n"
+ "Product Desc: %s\nProduct price: $%.2f\nOrder quantity: %d\n"
+ "Invoice type: %d\nInvoice discount: %.2f%%\nTax rate: %.2f%%\n"
+ "Invoice total: $%.2f\nInvoice count: %d\n\n"
+ "Press Enter to continue or 'x' to exit:",
anInvoice.getInvoiceNumber(), anInvoice.getInvoiceDate(),
anInvoice.getAProduct().getProductID(),
anInvoice.getAProduct().getProductDescription(),
anInvoice.getAProduct().getProductPrice(),
anInvoice.getOrderQuantity(), anInvoice.getInvoiceType(),
anInvoice.getDiscountPercent() * 100, anInvoice.getTAX_RATE() * 100,
anInvoice.getInvoiceTotal(), InvoiceWithProduct.getInvoiceCount());

// display output
choice = JOptionPane.showInputDialog
(null, outputMessage, "Invoice Application", JOptionPane.PLAIN_MESSAGE);
} // end while

System.exit(0);

} // end main

} // end


All times are GMT -4. The time now is 09:12 AM.

Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
2013 John Wiley & Sons, Inc.