Question
This is Java code , Please follow the instructions in the question. Implement an accountant class with elements including fields, constructors and methods. The class
This is Java code , Please follow the instructions in the question.
Implement an accountant class with elements including fields, constructors and methods. The class has three fields: name, age, and company name. Regarding constructors, there is one constructor that takes in three arguments n, a, and c. They will be assigned to name, age, and company name fields, respectively. Besides, the class has two methods. One method prints out the accountants salary depending on the age. The computation formula is as below.
40000 * sqrt( exp(0.04295 * age + 0.141) )
For sqrt and exp, please take advantage of the methods in the Math class. For example, Math.sqrt(9) returns 3. The salary should have 2-decimal precision. For example, if the salary is computed to be 51234.4543, the output should be
"$Salary:$" = $51234.45
The other method displays the fields in another format. Here shows an instance with name John, age 45 and company name compToday. The age occupies a 3-digit space, and represents a space.
\$Name:$\ = John, \$Age:$\ = 45, \$Company Name:$\ = compToday
Develop a MyProg class to start the execution and utilize the Scanner class to accept user inputs for name, age and company name. Instantiate an accountant object with field values from the inputs. Call each method once.
Besides, you should add single-line, multiple-line and javadoc comments to your program. Add a multiple-line comment to the MyProg class and list the URLs of the Math and Scanner classes.
Finally, use the javadoc tool to create the API for these two classes.
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