I have a Individual project due by midnight tonight for my intro to programming
ID: 3535800 • Letter: I
Question
I have a Individual project due by midnight tonight for my intro to programming class and don't really have time to work on it due to my work schedule if someone could help me out with this it'd be greatly appreciated! I need the following put into java code to add to my java program
The customer information that the customer must enter that should be validated includes the following:
In this assignment, you will add error handling to make sure the customer is filling in all of the required information. Then, you will output the order information to a file. Finally, you will read this file to display the order confirmation information on the screen to the customer.
Here is the code I already have existing for the program.
To change this template, choose Tools | Templates
* and open the template in the editor.
* Filename:pizzarusphase3.java
* Created: 5/3/2013 by ElderlySheep839
*
* Purpose: To allow creation of a login if a new customer and to simply
* login. If existing customer to allow and give the a customized greeting
* after introducing them to the pizzarus online ordering system.
*/
package pizzarusphase3;
import javax.swing.*;
public class pizzarusPhase3 {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// declare and initialize variables
String openingMsg,openingMsg1,openingMsg2,openingMsg3,openingMsg4,
openingMsg5,openingMsg6,openingMsg7,nameInputMsg,customerName,
nameOutputMsg,returnInputMsg,customerReturn,returnOutputMsg,
greetingOutputMsg,outPutMsg,userid, password, loginMsg, pwMsg,
invalidEntry = "Invalid Entry";
boolean returnYes, returnNo, returnInvalid, returnName, validCustomer;
int returnFlag;
// display opening message and system introduction
openingMsg1 = "***Welcome to pizzarus Online Ordering System*** *";
openingMsg2 = "You are now able to order your tackle through our online";
openingMsg3 = "take-out order system. *";
openingMsg4 = "The pizzarus types you can order here are:";
openingMsg5 = "pizzarus, pizzarus, and pizzarus *";
openingMsg6 = "The pizzarus sizes you can order here are:";
openingMsg7 = "all, edium, and arge *";
openingMsg = openingMsg1+openingMsg2+openingMsg3+openingMsg4+openingMsg5+
openingMsg6+openingMsg7;
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 or returning customer
switch(returnFlag)
{
case 1:
loginMsg = "Please enter your Current usename:";
userid = JOptionPane.showInputDialog(null,loginMsg);
pwMsg = "Please enter your Current password:";
password = JOptionPane.showInputDialog(null,pwMsg);
break;
case 2:
loginMsg = "Please enter your New usename:";
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 usename:";
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 entered 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);
}
}
else
break;
}
// build output strings
nameOutputMsg = "Welcome: " + customerName + ". ";
returnOutputMsg = "Your login is:" + userid + "/" + password + ". ";
greetingOutputMsg = "Thank you for visiting pizzarus!" + " ";
//create output string
outPutMsg = nameOutputMsg+returnOutputMsg+greetingOutputMsg;
//display output message
JOptionPane.showMessageDialog(null, outPutMsg);
System.exit(0);
}// end main
}// end class
If you could add the new code into the code I already have it'd be greatly appreciated
Explanation / Answer
I stored it here. http://www.shrib.com/2ZRV9wlk
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.