Java-Write a Police class with the following fields Officer's name

Write a Police class with the following fields:

• Officer's name

* Badge number

• Pay rate per hour

* Total number of hours worked.

The class should also include the following:


* Setter and getter methods { mutator and accessor methods}

* A constructor that takes as arguments the officer's name and the badge number

* A method that returns the officer's weekly pay {Hint: Total number of hours worked X pay rate per hour)


After you create the Police class, write a separate program that demonstrates the class by creating a Police object. The program should ask the user to input the data for a police officer, and then display the officer’s weekly pay.



1. Use comments when appropriate.

2. Give your variables meaningful and descriptive names. Naming a variable as " x", or “y" is a bad example of variable naming.

2. Use prompts to ask the user what they have to do. Be clear. Your program should be user-friendly. {Hint: Ask a family member or friend to run your program and then ask them if your prompts make sense and/or are clear).

4. Make sure you follow the directions precisely by using the required fields, the accessor and mutator methods, a constructor, and a method in the Police class.

5. For your separate program, make sure that you create an object, ask the user for input and display the weekly pay.

6. Your project should include 2 files: a) the Police class and b) a separate program to demonstrate the Police class. Therefore, you should create a folder with the 2 files, then zip the folder and submit the zipped folder,

Need a custom answer at your budget?

This assignment has been answered 5 times in private sessions.

© 2024 Codify Tutor. All rights reserved