Question

In: Computer Science

ou will create a GUI data entry program to be used to enter Customer Information. This...

ou will create a GUI data entry program to be used to enter Customer Information. This program should be based on the requirements and design you created in previous modules.

It will be a GUI, based either on the Java Swing classes or JavaFX. The program will allow for entry of all fields described in your requirements and include appropriate validations for each field. It will be left to you to decide if the validations methods should be part of the entry program or a separate validation class. You should use exception objects to reject invalid data, inform users and allow the program to fail securely. When a complete, correct Customer record has been completed, the user must be able to write the data to an encrypted file.

The requirements:

fields for first and last name, address, date, product, phone, secondary phone, email, complaints, employee name, employee id.

Build this as a project for your application and compress and submit the entire project file. See the Course Documents, Submitting Your Programs for more detail.

Solutions

Expert Solution

package com.company;
import javax.swing.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class Main {
public static void main(String[] args) {
JFrame f=new JFrame("GUI Example");

JLabel jl = new JLabel("First Name");
jl.setBounds(10, 10, 100, 20);

JTextField tf=new JTextField();
tf.setBounds(100,10, 150,20);

JLabel jl1 = new JLabel("Last Name");
jl1.setBounds(300, 10, 150, 20);

JTextField tf1 = new JTextField();
tf1.setBounds(500, 10, 150, 20);

JLabel jl2 = new JLabel("Address:");
jl2.setBounds(10, 50, 100, 20);

JTextField tf22 = new JTextField();
tf22.setBounds(100,50,150,20);
JTextField tf2 = new JTextField();
tf2.setBounds(100, 100, 150, 20);

JLabel jl3 = new JLabel("Date");
jl3.setBounds(300, 50, 150, 20);

JTextField tf3 = new JTextField();
tf3.setBounds(500, 50, 150, 20);

JLabel jl4 = new JLabel("Product");
JLabel jl5 = new JLabel("Phone");
JLabel jl6 = new JLabel("Secondary Phone");
JLabel jl7 = new JLabel("Email");
JLabel jl8 = new JLabel("Complaint");
JLabel jl9 = new JLabel("Employee Name");
JLabel jl10 = new JLabel("Employee ID");

jl4.setBounds(50,200, 150,20);
jl6.setBounds(50,300, 150,20);
jl8.setBounds(50,400, 150,20);
jl10.setBounds(50,500, 150,20);

jl5.setBounds(400, 200, 150, 20);
jl7.setBounds(400, 300, 150, 20);
jl9.setBounds(400, 400, 150, 20);

JTextField tf4 = new JTextField();
JTextField tf5 = new JTextField();
JTextField tf6 = new JTextField();
JTextField tf7 = new JTextField();
JTextField tf8 = new JTextField();
JTextField tf9 = new JTextField();
JTextField tf10 = new JTextField();

tf4.setBounds(200,200, 150,20);
tf5.setBounds(550, 200, 150, 20);
tf6.setBounds(200,300, 150,20);
tf7.setBounds(550, 300, 150, 20);
tf8.setBounds(200,400, 150,20);
tf9.setBounds(550, 400, 150, 20);
tf10.setBounds(200,500, 150,20);

JButton b=new JButton("Ok");
b.setBounds(350,700,95,30);
b.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
int counter = 0;
String phone = tf5.getText();
if (phone.length() == 10){
try{
Double d= Double.parseDouble(phone);
}catch (NumberFormatException nfe){
System.out.println("Enter correct number !");
counter ++;
}

}
else
System.out.println("Enter correct number OFf!");
counter++;


if (counter == 0)
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

}
});
f.add(b);f.add(tf);f.add(jl);f.add(jl1);f.add(tf1);f.add(jl2);f.add(tf2);f.add(tf22);
f.add(jl3);f.add(tf3);f.add(jl4);f.add(jl6);f.add(jl8);f.add(jl10);f.add(jl5);f.add(jl7);f.add(jl9);
f.add(tf4);
f.add(tf5);
f.add(tf6);
f.add(tf7);
f.add(tf8);
f.add(tf9);
f.add(tf10);
f.setSize(800,800);
f.setLayout(null);
f.setVisible(true);
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
}


Related Solutions

Design and implement a Java program that creates a GUI that will allow a customer to...
Design and implement a Java program that creates a GUI that will allow a customer to order pizza and other items from a Pizza Paarlor. The customer should be able to order a variety of items which are listed below. The GUI should allow the customer (viaJavaFX UI Controls - text areas, buttons, checkbox, radio button, etc.) to input the following information: Name of the customer First Name Last Name Phone number of the customer Type of food being order...
Create a program that will loop and prompt to enter the highlighted data items in the...
Create a program that will loop and prompt to enter the highlighted data items in the structure below. This is every item except customerNumber , isDeleted and newLine; const int NAME_SIZE = 20; const int STREET_SIZE = 30; const int CITY_SIZE = 20; const int STATE_CODE_SIZE = 3; struct Customers { long customerNumber; char name[NAME_SIZE]; char streetAddress_1[STREET_SIZE]; char streetAddress_2[STREET_SIZE]; char city[CITY_SIZE]; char state[STATE_CODE_SIZE]; int zipCode;     char isDeleted;     char newLine; }; Always set the item isDeleted to 'N' and...
Write a Java program to process the information for a bank customer.  Create a class to manage...
Write a Java program to process the information for a bank customer.  Create a class to manage an account, include the necessary data members and methods as necessary.  Develop a tester class to create an object and test all methods and print the info for 1 customer.  Your program must be able to read a record from keyboard, calculate the bonus and print the details to the monitor.  Bonus is 2% per year of deposit, if the amount is on deposit for 5 years...
In Python Create customer information system as follows: Python 3 Create customer information system as follows:...
In Python Create customer information system as follows: Python 3 Create customer information system as follows: Ask the user to enter name, phonenumber, email for each customer. Build a dictionary of dictionaries to hold 10 customers with each customer having a unique customer id. (random number generated) Take the keys of the above mentioned dictionary which are customer ids and make a list. Ask the use to enter a customer id and do a binary search to find if the...
Create in java an interactive GUI application program that will prompt the user to use one...
Create in java an interactive GUI application program that will prompt the user to use one of three calculators, label project name MEDCALC. You can use any color you want for your background other than grey. Be sure to label main java box with “MEDCALC” and include text of “For use only by students” On all three calculators create an alert and signature area for each user. The alert should be something like “All calculations must be confirmed by user...
Use the below info to create a java program A GUI interface to ensure a user...
Use the below info to create a java program A GUI interface to ensure a user is old enough to play a game. Properly formatted prompts to input name, address, phone number, and age. Remember that name, address, phone number, etc. can be broken out in additional fields. Refer to the tutorial from this week’s Reading Assignment Multiple vs. Single Field Capture for Phone Number Form Input for help with this. Instructions to ensure that the information is displayed back...
modify the code below to create a GUI program that accepts a String from the user...
modify the code below to create a GUI program that accepts a String from the user in a TextField and reports whether or not there are repeated characters in it. Thus your program is a client of the class which you created in question 1 above. N.B. most of the modification needs to occur in the constructor and the actionPerformed() methods. So you should spend time working out exactly what these two methods are doing, so that you can make...
How to create a program Budget Enter the amount budgeted for the month: 400 Enter the...
How to create a program Budget Enter the amount budgeted for the month: 400 Enter the expense (-1 to quite):100 Enter the expense (-1 to quite):-1 $400 budgeted. 1 expenses totaling $100. $300 under budget. Need to use sentinel value of -1, while loop
Create a Python program that: Allows the user to enter a phrase or sentence. The program...
Create a Python program that: Allows the user to enter a phrase or sentence. The program should then take the phrase or sentence entered Separate out the individual words entered Each individual word should then be added to a list After all of the words have been place in a list Sort the contents of the list Display the contents of the sorted list with each individual word displayed on a separate line Display a message to the user indicating...
Create in Java a program that will prompt the user to enter aweight for a...
Create in Java a program that will prompt the user to enter a weight for a patient in kilograms and that calculates both bolus and infusion rates based on weight of patient in an interactive GUI application, label it AMI Calculator. The patients weight will be the only entry from the user. Use 3999 as a standard for calculating BOLUS: To calculate the BOLUS you will multiply 60 times the weight of the patient for a total number. IF the...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT