Package edu.ucsb.cs156.happiercows.jobs
Class MilkTheCowsJob
java.lang.Object
edu.ucsb.cs156.happiercows.jobs.MilkTheCowsJob
- All Implemented Interfaces:
JobContextConsumer
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaccept(JobContext ctx) static doublecalculateMilkingProfit(Commons commons, UserCommons userCommons) Calculate the profit for a user from milking their cows.static StringformatDollars(double amount) static voidmilkCows(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:
acceptin 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:
-