|
|||||||||||||||||||
| Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
| Employee.java | 50% | 75% | 100% | 66.7% |
|
||||||||||||||
| 1 |
package modal;
|
|
| 2 |
|
|
| 3 |
import javax.swing.JOptionPane;
|
|
| 4 |
|
|
| 5 |
/**
|
|
| 6 |
* Employee class.
|
|
| 7 |
*
|
|
| 8 |
* The employee class is a simple application that drives a modal
|
|
| 9 |
* dialog as the employee is instanciated.
|
|
| 10 |
*
|
|
| 11 |
* @author Kevin Wilson
|
|
| 12 |
*/
|
|
| 13 |
public class Employee { |
|
| 14 |
|
|
| 15 |
/** Employee name. */
|
|
| 16 |
private String m_name;
|
|
| 17 |
|
|
| 18 |
/**
|
|
| 19 |
* Constructor for employee.
|
|
| 20 |
*/
|
|
| 21 | 2 |
public Employee() {
|
| 22 | 2 |
do {
|
| 23 | 2 |
m_name = JOptionPane.showInputDialog(null, "Name?", "New Employee", JOptionPane.PLAIN_MESSAGE); |
| 24 | 2 |
if (m_name.equals("")) { |
| 25 | 0 |
JOptionPane.showMessageDialog(null, "Blank names not allowed"); |
| 26 |
} |
|
| 27 | 2 |
} while (m_name.equals("")); |
| 28 |
} |
|
| 29 |
} |
|
| 30 |
|
|
||||||||||