solution

1.Please help me on my boolean method to make sure I get the right social security number input I gave up on it I’m not understanding how the teacher explained it.

2.Please help me create a method that will create an ID number with the format of first letters of first and last name plus 4 random numbers.
example. JD-1234

3.Please help me display this on main with the name, last name, dept and start year.

/**
*
*/
package Java2;

import javax.swing.JOptionPane;

/**
* @author
*
*/
public class classWork1 {
private String Name;
private String LastName;
private int socsecNum;
private int startYear;
private String dept;
private String idNum;
/**
* @param name
* @param lastName
* @param socsecNum
* @param startYear
* @param dept
* @param idNum
*/
public classWork1() {
// TODO Auto-generated constructor stub
}
public classWork1(String name, String lastName, int socsecNum, int startYear, String dept, String idNum) {
Name = name;
LastName = lastName;
this.socsecNum = socsecNum;
this.startYear = startYear;
this.dept = dept;
this.idNum = idNum;
}
/**
* @return the name
*/
public String getName() {
return Name;
}
/**
* @param name the name to set
*/
public void setName(String name) {
Name = name;
}
/**
* @return the lastName
*/
public String getLastName() {
return LastName;
}
/**
* @param lastName the lastName to set
*/
public void setLastName(String lastName) {
LastName = lastName;
}
/**
* @return the socsecNum
*/
public int getSocsecNum() {
return socsecNum;
}
/**
* @param socsecNum the socsecNum to set
*/
public void setSocsecNum(int socsecNum) {
this.socsecNum = socsecNum;
JOptionPane.showMessageDialog(null, socsecNum, “Social Security”, 3);
}
/**
* @return the startYear
*/
public int getStartYear() {
return startYear;
}
/**
* @param startYear the startYear to set
*/
public void setStartYear(int startYear) {
this.startYear = startYear;
}
public boolean setSS(int socsecNum) {
//check length
String socsecNum1 = String.valueOf(socsecNum);
if (socsecNum1.length() !=9)
{
JOptionPane.showMessageDialog(null, “Your social security is not the right number of characters!”, “Warning”, 3);
return false;
}
if(socsecNum1.length() ==9)
{
JOptionPane.showMessageDialog(null, “Your social security is the right number of characters!”, “Please continue”, 3);
return true;
}
else
{
System.out.println(“Error! Social Security must be in the format A###”);
return false;
}
}
/**
* @return the dept
*/
public String getDept() {
return dept;
}
/**
* @param dept the dept to set
*/
public void setDept(String dept) {
this.dept = dept;
}
/**
* @return the idNum
*/
public String getIdNum() {
return idNum;
}
/**
* @param idNum the idNum to set
*/
public void setIdNum(String idNum) {
this.idNum = idNum;
idNum = Name.stripLeading() + LastName.stripLeading() + String.valueOf(socsecNum);
JOptionPane.showMessageDialog(null, idNum, “Get ID”, 3);
}
public String toString()
{
return “Employee name: ” + Name + “” + LastName + “n” + “ID number: ” + Name.stripLeading() + LastName.stripLeading() + idNum ;
}

}

public class classWork1Main {

/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
String Name = null;
String LastName = null;
int socsecNum = 0;
int startYear= 0;
String dept = null;
String idNum = null;
classWork1 x = new classWork1();
do {
Name = JOptionPane.showInputDialog(null, “Enter your name: “);
LastName = JOptionPane.showInputDialog(null, “Enter your last name: “);
dept = JOptionPane.showInputDialog(null, “Enter your department: “);
socsecNum = Integer.parseInt(JOptionPane.showInputDialog(null, “Enter your social security number: “, “Social Security Number”, 2));
x.setSocsecNum(socsecNum);
x.getIdNum();
} while(!x.setSS(socsecNum));

 
"Looking for a Similar Assignment? Get Expert Help at an Amazing Discount!"
Looking for a Similar Assignment? Our Experts can help. Use the coupon code SAVE30 to get your first order at 30% off!