Monday, February 9, 2009

/*Programmer:Miexie D. Tulid
*Title:ClothingTester class
*Status: it really work.! Try mo....*/


import javax.swing.JOptionPane;

public class ClothingTester
{
public static void main(String ars[]){
Shirt shirt1=new Shirt(0,20,"dark","men's wear",2);
Shirt shirt2=new Shirt(1,6,"red","ladies' wear",7);
Shirt shirt3=new Shirt(2,17,"rainbow","children's wear",5);


System.out.println(shirt1.displayInformation()+"\n\n");
System.out.println(shirt2.displayInformation()+"\n\n");
System.out.println(shirt3.displayInformation()+"\n\n");




String ans="mix";

while(ans!="Yes"||ans!="No"){
ans=JOptionPane.showInputDialog("Would you like to place an order?\n(Yes/No)");
if(ans.equals("Yes")){
JOptionPane.showMessageDialog(null,"Please fill in the following form.","Clothing Order Interface",JOptionPane.PLAIN_MESSAGE);
String id=JOptionPane.showInputDialog("Enter your id");
String name=JOptionPane.showInputDialog("Enter your name");
String address=JOptionPane.showInputDialog("Enter your address");
String phone=JOptionPane.showInputDialog("Enter your phone number");
String email=JOptionPane.showInputDialog("Enter your e-mail address");
JOptionPane.showMessageDialog(null,"Thank you!\nNow please fill in the order form.","Clothing Order Interface",JOptionPane.PLAIN_MESSAGE);
String shirtord=JOptionPane.showInputDialog("Enter the shirt id you want to purchase");
String quanord=JOptionPane.showInputDialog("Enter the quantity");
int cid=Integer.parseInt(id);
int shirtno=Integer.parseInt(shirtord);
int shirtquan=Integer.parseInt(quanord);
Customer customer=new Customer(cid,name,address,phone,email,shirtno,shirtquan);
System.out.println(customer.placeorder());
JOptionPane.showMessageDialog(null,"Look at your profile on the screen!","Clothing Order Interface",JOptionPane.PLAIN_MESSAGE);
JOptionPane.showMessageDialog(null,"Thank you!\nNow fill in the payment form","Clothing Order Interface",JOptionPane.PLAIN_MESSAGE);
String fpayment="mix";
while(fpayment!="Credit card"||fpayment!="Check"){
fpayment=JOptionPane.showInputDialog("Enter your form of payment\n(Credit card/Check)");
if(fpayment.equals("Credit card")){
String screditno=JOptionPane.showInputDialog("Enter your credit card no");
String date=JOptionPane.showInputDialog("Enter its expiration date");
int creditno=Integer.parseInt(screditno);
FormofPayment payment=new FormofPayment(fpayment,creditno,date);
JOptionPane.showMessageDialog(null,"Submit?","Clothing Order Interface",JOptionPane.PLAIN_MESSAGE);

String submit="mix";
while(submit!="Ok"){
String svcreditno=JOptionPane.showInputDialog("Verify your credit card no");
int vcreditno=Integer.parseInt(svcreditno);
submit=payment.verifyCardno(vcreditno);
if(submit.equals("Ok")){
JOptionPane.showMessageDialog(null,"Your credit card has been verified!","Clothing Order Interface",JOptionPane.PLAIN_MESSAGE);

}
else{
JOptionPane.showMessageDialog(null,"Your credit card has been denied!\nPlease try again.","Clothing Order Interface",JOptionPane.PLAIN_MESSAGE);

}
}//end submit while

}//end if credit
else if(fpayment.equals("Check")){
String screditno=JOptionPane.showInputDialog("Enter your check no");
String date=JOptionPane.showInputDialog("Enter its expiration date");
int creditno=Integer.parseInt(screditno);
FormofPayment payment=new FormofPayment(creditno,date);
JOptionPane.showMessageDialog(null,"Submit?","Clothing Order Interface",JOptionPane.PLAIN_MESSAGE);

String submit="mix";
while(submit!="Ok"){
String svcreditno=JOptionPane.showInputDialog("Verify your check no");
int vcreditno=Integer.parseInt(svcreditno);
submit=payment.verifyChekPayment(vcreditno);
if(submit=="Ok"){
JOptionPane.showMessageDialog(null,"Your check has been verified!","Clothing Order Interface",JOptionPane.PLAIN_MESSAGE);

}
else{
JOptionPane.showMessageDialog(null,"Your check has been denied!\nPlease try again.","Clothing Order Interface",JOptionPane.PLAIN_MESSAGE);

}
}//end submit while

}//end elseif credit

else{
JOptionPane.showMessageDialog(null,"Invalid input!\nPlease try again.","Clothing Order Interface",JOptionPane.PLAIN_MESSAGE);

}




}

}
else if(ans.equals("No")){
JOptionPane.showMessageDialog(null,"Goodbye!","Clothing Order Interface",JOptionPane.PLAIN_MESSAGE);

}

else {
JOptionPane.showMessageDialog(null,"Invalid input!\nPlease try again.","Clothing Order Interface",JOptionPane.PLAIN_MESSAGE);

}





}
}
}

No comments:

Post a Comment