Database + including in a GUI
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   lee_morgan
Posted On:   Friday, January 18, 2002 04:00 AM

Ive got this test class below: import java.util.Vector; import MisIO.*; public class TesterOne { public static void main(String args[]) { /* THIS CODE NEEDS TO BE IN A GUI */ System.out.println("type receipt number : "); String l = BasicIO.readString(); System.out.println("type name : "); String x = BasicIO.readString(); System.out.println("type address : "); String y = BasicIO.readString(); System.out.println("type date : "); String z = Basic   More>>

Ive got this test class below:


import java.util.Vector;


import MisIO.*;



public class TesterOne


{


public static void main(String args[])


{



/* THIS CODE NEEDS TO BE IN A GUI */



System.out.println("type receipt number : ");


String l = BasicIO.readString();


System.out.println("type name : ");


String x = BasicIO.readString();


System.out.println("type address : ");


String y = BasicIO.readString();


System.out.println("type date : ");


String z = BasicIO.readString();


System.out.println("type amount : ");


String m = BasicIO.readString();


// create a customer


Customer firstCustomer = new Customer(l, x, y, z, m); ;




Customer.initialize();


try // test addNew


{


firstCustomer.addNew();



System.out.println("added customer");


}


catch(DuplicateException e)


{System.out.println(e);}



// test getAll


Vector allCustomers = Customer.getAll();


for(int i = 0; i <

allCustomers.size(); i++)


{ // display attributes for each customer retrieved


firstCustomer = (Customer) allCustomers.elementAt(i);


System.out.println

("getAll " + firstCustomer.tellAboutSelf());


}




/* THIS CODE NEEDS TO BE IN A SEPERATE GUI */



System.out.println();


System.out.println("type name to find : ");


String h = BasicIO.readString();



try // test find


{


firstCustomer = Customer.find(h);


System.out.println("find " + firstCustomer.tellAboutSelf());


}


catch(NotFoundException e)


{System.out.println(e);}




/* IGNORE CODE BELOW */



/*try // test delete


{ // delete customer


firstCustomer.delete();


System.out.println

("delete " + firstCustomer.tellAboutSelf());


// try to find the customer just deleted


firstCustomer = Customer.find(d);


System.out.println("find " + firstCustomer.tellAboutSelf());


}


catch(NotFoundException e)


{System.out.println(e);} */



/*try // test update


{ // change address for customer


firstCustomer = Customer.find(h);


firstCustomer.setAddress("Coventry");


firstCustomer.update();


// display address after change


firstCustomer = Customer.find(h);


System.out.println("update " + firstCustomer.tellAboutSelf());


}


catch(NotFoundException e)


{System.out.println(e);}


*/
Customer.terminate();


}


}





This adds one customer to a file and then finds a customer based on a variable typed in, I need to put these two bits of code in two seperate GUIs, the one to add the customer I have already created and works fine, but I'm having trouble with the one to find a customer due to the

Customer firstCustomer = new Customer(l, x, y, z, m);


statement.


I somehow need to pass the 5 variables to the other gui ?? any help or code would be much appreciated.Lee.

   <<Less
About | Sitemap | Contact