Class MilkTheCowsJob
java.lang.Object
edu.ucsb.cs156.happiercows.jobs.MilkTheCowsJob
- All Implemented Interfaces:
edu.ucsb.cs156.jobs.services.JobContextConsumer
public class MilkTheCowsJob
extends Object
implements edu.ucsb.cs156.jobs.services.JobContextConsumer
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaccept(edu.ucsb.cs156.jobs.services.JobContext ctx) static doublecalculateMilkingProfit(Game game, Farmer farmer) Calculate the profit for a user from milking their cows.static StringformatDollars(double amount) static voidmilkCows(edu.ucsb.cs156.jobs.services.JobContext ctx, Game game, Farmer farmer, ProfitRepository profitRepository, FarmerRepository farmerRepository) This method performs the function of milking the cows for a single farmer.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface edu.ucsb.cs156.jobs.services.JobContextConsumer
getJobName, getScopeId, getScopeType
-
Constructor Details
-
MilkTheCowsJob
public MilkTheCowsJob()
-
-
Method Details
-
formatDollars
-
accept
-
milkCows
public static void milkCows(edu.ucsb.cs156.jobs.services.JobContext ctx, Game game, Farmer farmer, ProfitRepository profitRepository, FarmerRepository farmerRepository) This method performs the function of milking the cows for a single farmer. It is a public method only so it can be exposed to the unit tests- Parameters:
ctx- the JobContextgame- the Gamefarmer- the Farmer
-
calculateMilkingProfit
-