/*
         * Extract the condition into its own method.
         * ·           Extract the then part and the else part into their own methods.
         *  ?? Was ist der Standardfall
         */
        public void aMethod(MyDateTime date, double quantity)
        {
            double charge = 0;

            if (date.before(SUMMER_START) || date.after(SUMMER_END))
            {
                double specialRate = _winterRate * 2;
                if (date.after(SUMMER_END))
                {
                    charge = _winterRate + specialRate;
                }
                else if (date.before(SUMMER_START))
                {
                    charge = _winterRate;
                }
                if (date.isFriday() && charge > quantity * 3)
                {
                    charge = quantity * _winterRate + _winterServiceCharge;
                }
                charge += quantity * _winterRate + _winterServiceCharge;
            }
            else
            {
                charge = quantity * _summerRate;
            }
        }
        /*
         * Extract the condition into its own method.
         * ·           Extract the then part and the else part into their own methods.
         */
        public void aMethod(MyDateTime date, double quantity)
        {
            double charge;

            if (date.before(SUMMER_START) || date.after(SUMMER_END))
            {
                charge = quantity * _winterRate + _winterServiceCharge;
            }
            else
            {
                charge = quantity * _summerRate;
            }
        }
 private bool DateNotIinSesaon(MyDateTime date)
 {
     return(date.before(SUMMER_START) || date.after(SUMMER_END));
 }
Exemplo n.º 4
0
 private bool NotInSeason(MyDateTime date)
 {
     return(date.before(SUMMER_START) || date.after(SUMMER_END));
 }
Exemplo n.º 5
0
 private bool OnSeasonPrice(MyDateTime date)
 {
     return(date.before(SUMMER_START));
 }