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.static String
formatDollars
(double amount) static void
milkCows
(JobContext ctx, Commons commons, UserCommons userCommons, ProfitRepository profitRepository, UserCommonsRepository userCommonsRepository) 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
public static void milkCows(JobContext ctx, Commons commons, UserCommons userCommons, ProfitRepository profitRepository, UserCommonsRepository userCommonsRepository) 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:
-