Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Suppose that for the Employee method pay of Exercise 4.6, hours and rate are par

ID: 3622281 • Letter: S

Question

Suppose that for the Employee method pay of Exercise 4.6, hours and rate are parameters rather than instance variables. That is, supposed the method is specified as

public double pay (int hours, double rate)

Write a complete specification, including reasonable preconditions and postconditions, for this method.
Also, Develop a test plan for the method pay of this class.

Explanation / Answer

Dear, class employee { private int hours; private double rate; public employee(int hr,double rt) { hours=hr; rate= rt; } public double pay(int hr,double rt) { double totpay; if(hr>0) { totpay=hr*rt; } return totpay; } } public class test { public static void main(String[] args) { employee obj=new employee(); //function call to to get pay System.out.println("Total pay:"+obj.pay(64,500)); System.exit(0); } }

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote