Coding
You are on the Welcoming Committee at “Geeks –R- Us”, you are tasked with building a basic information data sheet on the new potential employees. Write a program that will display a (prototype of new layout) the first name, middle initial, last name, full name (store first name, middle name and last name into full name) age, salary and sex of new employee. Then displays that person’s name with the first name first, middle initial followed by a period, and last name then age, salary and sex on the monitor. Make sure the output is easy to read and understand.
Use good programming techniques.
Must do this homework twice, one using System.out.println(" ");
and one using JOptionPane.
Each is worth 50 points.
Good Luck :-)
Below is something I was working on:
mport javax.swing.*; // for JOptionPane
public class GilHomework_1 {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// declare variable
String firstName, lastName, fullName, age, sex;
char middleInit;
float salary;
//assign variable
firstName = " Gilberto";
middleInit = 'M';
lastName = "Rodriguez";
fullName = "Gilberto M. Rodriguez";
sex = "male";
age = "51";
salary = 50000;
//output usingJOptionPane
JOptionPane.showMessageDialog(null, // center on monitor
"Your first name is" + firstName
+ " your middle initial is " + middleInit
+ " and your last name is " + lastName + "."
+ " " + fullName + ","
+ " You are a " + age + " year old " + sex + "."
+ " and you make $" + salary + " a year. ",// text in the dialog box
"GilHomework_1", //title of dialog box
JOptionPane.INFORMATION_MESSAGE;
}
}