Package edu.ucsb.cs156.happiercows.jobs
Class MilkTheCowsJob
java.lang.Object
edu.ucsb.cs156.happiercows.jobs.MilkTheCowsJob
- All Implemented Interfaces:
JobContextConsumer
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
accept
(JobContext ctx) static double
calculateMilkingProfit
(Commons commons, UserCommons userCommons) Calculate the profit for a user from milking their cows.formatDollars
(double amount) void
milkCows
(JobContext ctx, Commons commons, UserCommons userCommons) This method performs the function of milking the cows for a single userCommons.
-
Constructor Details
-
MilkTheCowsJob
public MilkTheCowsJob()
-
-
Method Details
-
formatDollars
-
accept
- Specified by:
accept
in interfaceJobContextConsumer
- Throws:
Exception
-
milkCows
This method performs the function of milking the cows for a single userCommons. It is a public method only so it can be exposed to the unit tests- Parameters:
ctx
- the JobContextcommons
- the CommonsuserCommons
- the UserCommons
-
calculateMilkingProfit
Calculate the profit for a user from milking their cows.- Parameters:
userCommons
-- Returns:
-