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 Details

    • MilkTheCowsJob

      public MilkTheCowsJob()
  • Method Details

    • formatDollars

      public static String formatDollars(double amount)
    • accept

      public void accept(edu.ucsb.cs156.jobs.services.JobContext ctx) throws Exception
      Specified by:
      accept in interface edu.ucsb.cs156.jobs.services.JobContextConsumer
      Throws:
      Exception
    • 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 JobContext
      game - the Game
      farmer - the Farmer
    • calculateMilkingProfit

      public static double calculateMilkingProfit(Game game, Farmer farmer)
      Calculate the profit for a user from milking their cows.
      Parameters:
      farmer -
      Returns: