Question
//public class Employee // private String firstName; // private String lastName; // private Double monthlySalary; // public Employee(double monthly) { if (monthly > 0.00) monthlySalary
//public class Employee
// private String firstName; // private String lastName; // private Double monthlySalary; // public Employee(double monthly) { if (monthly > 0.00) monthlySalary = monthly; if (monthly< 0.00) monthlySalary = 0.00; } // end Salaryconstructor
// method to set first name // public void setFirstName(String first) { firstName = first; } // end method setFirstName
// method to set last name // public void setLastName(String last) { lastName = last; } // end method setLastName // method to setmonthly salary // public void setMonthlySalary(Double monthly) { monthlySalary = monthly; } // end method setLastName // method toretrieve first name // public String getFirstName() { return firstName; } // end method getFirstName // method toretrieve last name // public String getLastName() { return lastName; } // end method getFirstName // method toretrieve first name //public Double getMonthlySalary() { return monthlySalary; } // end method getMonthlySalary
// method to display employee information to user // public void displayMessage() { System.out.printf("%s %s has a monthly salary of$%.2f ", getFirstName(), getLastName(), getMonthlySalary()); } // end method displayMessage } // end class Employee //page 104 Exercise 3.14EmployeeTest //public classEmployeeTest { // main method begins execution of Java application public static void main(String args[]) { Scanner input = new Scanner(System.in); EmployeenewEmployee = new Employee(0.00); System.out.println("Please enter Employee's firstname:"); String first = input.nextLine(); newEmployee.setFirstName(first); System.out.println();
System.out.println("Please enter Employee's lastname:"); String last = input.nextLine(); newEmployee.setLastName(last); System.out.println(); System.out.println("Please enter Employee'smonthly salary:"); double monthly = input.nextDouble(); newEmployee.setMonthlySalary(monthly); System.out.println();
newEmployee.displayMessage(); } // end methodmain // end class EmployeeTest #include "stdafx.h" having errors in visual studio c++ { has red line underneath something about declaration missing only braces facing{
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started