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

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...
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...
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...
In Python Create customer information system as follows: Ask the user to enter name, phonenumber, email....
In Python Create customer information system as follows: Ask the user to enter name, phonenumber, email. Create a file by his name and save it in the hard disk. Do this repeatedly until all the users are entered. (for example, if the user enters 10 customers’s information, there should be 10 different files created.) Now build the customer value for a retail company as follows: Ask the customer to enter his name. If you have his information already stored, then...
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...
Use Matlab GUIDE to create a program with graphic user interfac(GUI). The program is designed to...
Use Matlab GUIDE to create a program with graphic user interfac(GUI). The program is designed to convert the temperature from Celsius to Fahrenheit and the opposite. (Hint: use radio button)
Design and implement a Java program to create a GUI application that for calculating an employee’s...
Design and implement a Java program to create a GUI application that for calculating an employee’s travel expenses and reimbursement. The user will enter the following data: ∙ Number of days on the trip ∙ Amount of the airfare, if any ∙ Amount of car rental fees, if any ∙ Number of miles driven, if a private vehicle is used ∙ Amount of parking fees, if any ∙ Amount of taxi charges, if any ∙ Conference or seminar registration fees,...
Medical Calculator Create a python program that allows the user to enter the following patient information:...
Medical Calculator Create a python program that allows the user to enter the following patient information: First name and Last name gender age weight height systolic pressure and diastolic pressure current body temperature in degrees Fahrenheit Once the information is entered then the results should be printed on the display based on the information below: BMI Temp Conversion Mean Blood Pressure Weight Conversion (lbs to kg) Height Conversion (inches to cm) Output should be in the following format: First Name...
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...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT