Assignment 3: Input validation, throwing exceptions, overriding toString
Instructions: Complete Java code so that it meets the following requirements. When you are ready to turn in your project for a grade, upload it to Canvas under the Assignment3 assignment link. Before uploading it, right click the project folder in the directory that holds your NetBeans projects, and select ‘Send To”, then select the option to compress (zip) it. This compresses all of the files so that I can run the code myself. To upload the compressed file, select the ‘Assignments’ link on Canvas, select this assignment and click ‘Submit Assignment’. Click the “Browse To” button and navigate to the directory that holds your compressed folder and select it.
You should only use Java code that we have covered up to this point.
Assignment 3 Instructions:
Edit Assignment 2 to use a set method that validates that the hourly employee’s rate of pay is not less than $15.00/hour and not greater than $30.00. If it is, throw an illegal argument exception that is caught and an appropriate message is printed stating the error. Override the object’s toString method in the Hourly class so that the main method prints the object’s information (name and weekly pay) by its name only (i.e. System.out.println(objectname);). Be sure to make the output look nice.

Solution PreviewSolution Preview

These solutions may offer step-by-step problem-solving explanations or good writing examples that include modern styles of formatting and construction of bibliographies out of text citations and references. Students may use these solutions for personal skill-building and practice. Unethical use is strictly forbidden.

package hourlytest;

public class Hourly {
    public enum status {
       fulltime, parttime;

    private String fName; //Private String fName variable
    private String lName; //Private String lName variable
    private double hourly; //Private int hourly variable
    private double hours; //Private double hours worked variable
    private double weekly; //Private double weekly variable
    private status employment;
    private Date birthDate;
    private Date hireDate;

    public Hourly() {
    public Hourly(String fName, String lName, double hourly, double hours, Date birthDate, Date hireDate) {

       this.fName = fName; //shadowed variable fName
       this.lName = lName; //Shadowed variable lName

       if (hourly >= 15 && hourly <= 30) {
            this.hourly = hourly;
       } else {

            System.out.println("You have entered an invalid number for hourly you need to input a number that is between 15 and 30 ");
       if (hours >= 0 && hours <= 80) {
            this.hours = hours;
       } else {

            System.out.println("You have entered an invalid number for hours you need to input a number that is between 0 and 80 ");
       this.birthDate = birthDate;
       this.hireDate = hireDate...

By purchasing this solution you'll be able to access the following files:

50% discount

$25.00 $12.50
for this solution

or FREE if you
register a new account!

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Find A Tutor

View available Java Programming Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.

Upload a file
Continue without uploading

We couldn't find that subject.
Please select the best match from the list below.

We'll send you an email right away. If it's not in your inbox, check your spam folder.

  • 1
  • 2
  • 3
Live Chats