The customer information that the customer must enter that should be validated i
ID: 3635640 • Letter: T
Question
The customer information that the customer must enter that should be validated includes the following:?Enter if returning customer (must enter y or n)
?Enter user name (must fill in a name)
?Enter at least 1 product to order
?Enter attributes for product, if applicable (such as size and color)
?Enter quantity (must enter 1–99)
?Enter delivery address that includes street, city, state, and zip
?Enter telephone number using this format: (xxx)xxx-xxxx
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
* Filename: bowflexphase3.java
* Created 12/12/11 by Anibal Burgos
*
* Prupose: To allow creation of a login if a new customer and to simply
* login if existing customer to allow and give them a customized greeting
* after introducing them to the Bowflex online ordering system.
* to allow user to enter product order, quantity, dilivery address.
*/
package bowflexpahse3;
import javax.swing.*;
/**
*
* @author Anibal
*/
public class Bowflexpahse3 {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// declare and initialize variables
String openingMsg, nameInputMsg, customerName, nameOutputMsg,
returnInputMsg, customerReturn, returnOutputMsg,
greetingOutputMsg, outputMsg,
openingMsg1, openingMsg2, openingMsg3, openingMsg4,
openingMsg5, userid, password,loginMsg, pwMsg,
invalidEntry = "Invalid Entry";
boolean returnYes, returnNo, returnInvalid, retunName, validCustomer;
int returnFlag;
// display opening message and system introduction
openingMsg1 = "*** Welcome to Bowflex Online Ordering System *** ";
openingMsg2 = "You are now able to order your bowflex through our online";
openingMsg3 = "order system. ";
openingMsg4 = "The size of dumbbell you can oder are";
openingMsg5 = "SelectTech 552 or SelecTech 560 ";
openingMsg = openingMsg1 + openingMsg2 + openingMsg3 + openingMsg4
+ openingMsg5;
JOptionPane.showMessageDialog(null, openingMsg);
// determine if they are a new or returning customer
returnInputMsg = "Are you a returning customer(Enter y or n)?";
customerReturn = JOptionPane.showInputDialog(returnInputMsg);
returnYes = customerReturn.equalsIgnoreCase("y");
returnNo = customerReturn.equalsIgnoreCase("n");
// initialize return flag
if (returnYes)
returnFlag = 1;
else if (returnNo)
returnFlag = 2;
else
returnFlag = 0;
//determine if new customer or returning customer
switch(returnFlag)
{
case 1:
loginMsg = "Please enter your Current username:";
userid = JOptionPane.showInputDialog(null, loginMsg);
pwMsg = "Please enter your Current Username:";
password = JOptionPane.showInputDialog(null, pwMsg);
break;
case 2:
loginMsg = "Please enter yout New username:";
userid = JOptionPane.showInputDialog(null, loginMsg);
pwMsg = "Please enter your New Password:";
password = " JOptionPane.showInputDialog(null, pwMsg)";
break;
default:
JOptionPane.showMessageDialog(null,invalidEntry);
loginMsg = "Please enter your New username:";
userid = JOptionPane.showInputDialog(null, loginMsg);
pwMsg = "Please enter your New password:";
password = JOptionPane.showInputDialog(null, pwMsg);
}// end switch
// get required customer name using dialog boxes
nameInputMsg = "Enter your name:";
customerName = JOptionPane.showInputDialog(nameInputMsg);
// repeat until a name is enter or exit after 3 tries
for (int i =1; i <= 3; i++)
{
validCustomer = customerName.isEmpty();
if(validCustomer);
{
JOptionPane.showMessageDialog(null, invalidEntry);
if(i==3)
System.exit(0);
else
{
nameInputMsg = "Enter your name:";
customerName = JOptionPane.showInputDialog(nameInputMsg);
}
}
break;
}
// build output strings
nameOutputMsg = "Welcome " + customerName + ". ";
returnOutputMsg = "Your login is:" +userid + "/" + password + ". ";
greetingOutputMsg = "Thank you for visiting Bowflex!" + " ";
// create output string
outputMsg = nameOutputMsg + returnOutputMsg + greetingOutputMsg;
// display output message
JOptionPane.showMessageDialog(null, outputMsg);
System.exit(0);
} // end main
} // end class
Explanation / Answer
Hi i have solved this question on my laptop, but i can't type it and post it here because time has expired please rate me lifesaver and i'll make sure the answer is in your inbox! or my effort and time would go all in vain i don't do this generally but i am doing because of the circumstances
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.