Class MilkTheCowsJob

java.lang.Object
edu.ucsb.cs156.happiercows.jobs.MilkTheCowsJob
All Implemented Interfaces:
JobContextConsumer

public class MilkTheCowsJob extends Object implements JobContextConsumer
  • Constructor Details

    • MilkTheCowsJob

      public MilkTheCowsJob()
  • Method Details

    • formatDollars

      public String formatDollars(double amount)
    • accept

      public void accept(JobContext ctx) throws Exception
      Specified by:
      accept in interface JobContextConsumer
      Throws:
      Exception
    • milkCows

      public void milkCows(JobContext ctx, Commons commons, UserCommons userCommons)
      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 JobContext
      commons - the Commons
      userCommons - the UserCommons
    • calculateMilkingProfit

      public static double calculateMilkingProfit(Commons commons, UserCommons userCommons)
      Calculate the profit for a user from milking their cows.
      Parameters:
      userCommons -
      Returns: