Skip to content

Excercise05_01 (Show solution) #55

@Micha10

Description

@Micha10

Excercise05_01 (Show solution)

ext fun endDateGreaterThanStartDate(c: Course) : boolean {
  if c.endDate.year - c.startDate.year > 0 then true
    else if c.endDate.year - c.startDate.year < 0 then false
  else if c.endDate.month - c.startDate.month > 0 then true
  else if c.endDate.month - c.startDate.month > 0 then true
  else if c.endDate.month - c.startDate.month < 0 then false
  else if c.endDate.day - c.startDate.day >= 0 then true else false
 }

the line "else if c.endDate.month - c.startDate.month > 0 then true" is duplicated.
Should month be replaced with day?

ext fun endDateGreaterThanStartDate(c: Course) : boolean {
  if c.endDate.year - c.startDate.year > 0 then true
    else if c.endDate.year - c.startDate.year < 0 then false
  else if c.endDate.month - c.startDate.month > 0 then true
  else if c.endDate.month - c.startDate.month < 0 then false
  else if c.endDate.day - c.startDate.day >= 0 then true  else false
 }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions