6. Using the following declarations in an Employee form:
System.Windows.Forms.TextBox employeeNameTXT;
System.Windows.Forms.TextBox employeeSalaryTXT;
public EmployeeData employee = new EmployeeData();
And the EmployeeData class below:
public class EmployeeData
{
public string empName;
public string empSalary;
}
Write the statements needed to achieve the logic descriptions below.
1) If the employee name text box is not empty, display a message stating a value is not
required in this field
2) If the employee salary text box is over 100, display a message asking if the user wants
to open an investment account
3) If the employee name text box is not empty and the employee salary text box is greater
than or equal to zero, then get the values from the form and store them in the
EmployeeData class.
Code will be like:
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
//1
if(employeeNameTXT.Text !=string.Empty)
{
MessageBox.Show("stating a value is not required in this
field");
}
if (Convert.ToDouble(employeeSalaryTXT.Text)>100)
{
MessageBox.Show("Do you want to open an investment account");
}
if (employeeNameTXT.Text != string.Empty)
{
if (Convert.ToDouble(employeeSalaryTXT.Text) >0)
{
EmployeeData obj = new EmployeeData();
obj.empName = employeeNameTXT.Text;
obj.empSalary = employeeSalaryTXT.Text;
}
}
}
public class EmployeeData
{
public string empName;
public string empSalary;
}
Please rate it if the above solution helps you in any way or if you have any concerns comment it, I will help you through again.
6. Using the following declarations in an Employee form: System.Windows.Forms.TextBox employeeNameTXT; System.Windows.Forms.TextBox employeeSalaryTXT; public EmployeeData employee...
create java application with the following specifications: -create an employee class with the following attibutes: name and salary -add constuctor with arguments to initialize the attributes to valid values -write corresponding get and set methods for the attributes -add a method in Employee called verify() that returns true/false and validates that the salary falls in range1,000.00-99,999.99 Add a test application class to allow the user to enter employee information and display output: -using input(either scanner or jOption), allow user to...
Following is the EmployeeTester class, which creates object of the class Employee and calls the methods of that object. The EmployeeTester class is written to test another class: Employee. You are required to implement the class Employee by: declaring its instance variables: name, age, salary. implementing its constructor. implementing its methods: getEmployeeName(), getEmployeeAge(), getEmployeeSalary(), setEmployeeAge(int empAge), setEmployeeSalary(double empSalary) public class EmployeeTester { public static void main(String args[]) { // Construct an object Employee employeeOne = new Employee("Ahmad Abdullah"); //...
HospitalEmployee Inheritance help please.
import java.text.NumberFormat;
public class HospitalEmployee
{
private String empName;
private int empNumber;
private double hoursWorked;
private double payRate;
private static int hospitalEmployeeCount = 0;
//-----------------------------------------------------------------
// Sets up this hospital employee with default
information.
//-----------------------------------------------------------------
public HospitalEmployee()
{
empName = "Chris Smith";
empNumber = 9999;
hoursWorked = 0;
payRate =0;
hospitalEmployeeCount++;
}
//overloaded constructor.
public HospitalEmployee(String eName,...
Java
Do 68a, 68b, 68c, 68d. Show code & output.
public class Employee { private int id; private String name; private int sal; public Employee(int id, String name, int sal) { super(); this.id = id; this.name = name; this.sal = sal; } public int getid) { return id; } public void setId(int id) { this.id = id; } public String getName() { return name; public void setName(String name) { this.name = name; } public int get Sall) { return sal;...
JAVA: How do I output all the data included for each employee? I can only get it to output the name, monthly salary and annual salary, but only from the Employee.java file, not Salesman.java or Executive.java. Employee.java package project1; public class Employee { private String name; private int monthlySalary; public Employee(String name, int monthlySalary) { this.name = name; this.monthlySalary = monthlySalary; } public int getAnnualSalary() { int totalPay = 0; totalPay = 12 * monthlySalary; return totalPay; } public String...
IN JAVA Ask the user for three employees. Store the data into three employee objects (use the Employee class from the previous question). Display those employees in a table. On this question, you'll submit two files: Employee.java and some other file that has a main. Standard Input Bill Gates 1234 Engineering Engineer Elon Musk 4443 Business CEO Steve Jobs 9999 Creative Designer Required Output -- Employee Entry Form --\n Enter name\n Enter ID\n Enter department\n Enter position\n -- Employee...
In this exercise, you’ll add code to a form that converts the
value the user enters based on the selected conversion type.
The application should handle the following conversions:
1. Open the Conversions project. Display the code for the form,
and notice the rectangular array whose rows contain the value to be
displayed in the combo box, the text for the labels that identify
the two text boxes, and the multiplier for the conversion as shown
above. Note: An array...
Programming: Create a class called City with two public variables: a string to store the name of the city and a float to store the average temperature in Fahrenheit. Create one object of the class that you create and ask the user to enter the city name and the average temperature in Fahrenheit. Store these in the object of the class that you create. Then display the contents of the class. Once that is working, make the variables private and...
Zander Inc. stores employee IDs and salaries in a sequential
access file named Employees.txt. Open the VB2015\Chap10\Zander
Solution\Zander Solution (Zander Solution.sln) file. Open the
Employees.txt file, which is contained in the project’s bin\Debug
folder. The ID and salary information appear on separate lines in
the file. Close the Employees.txt window. a. Define a structure
named Employee. The structure should contain two member
variables:
a String variable to store the ID and a Double variable to store
the salary.
b. Declare...