Skip to content

Añadir ejercicio 043-inheritance_and_polymorphism #62

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

josemoracard
Copy link
Contributor

No description provided.

@tommygonzaleza
Copy link
Contributor

tommygonzaleza commented Jan 17, 2024

  • Agregar tests con ChatGPT, para que valide:
    • La clase CollegeStudent existe
    • La clase CollegeStudent tiene el atributo name.
    • La clase CollegeStudent tiene el atributo age.
    • La clase CollegeStudent tiene el atributo grade.
    • La clase CollegeStudent tiene el atributo major.
    • La clase CollegeStudent tiene el metodo introduce.
    • El metodo introduce retorna el string esperado (Valida en el mismo test con dos escenarios).
    • La clase CollegeStudent tiene el metodo study.
    • El metodo study retorna el string esperado (Valida en el mismo test con dos escenarios).
    • La clase CollegeStudent tiene el metodo attend_lecture.
    • El metodo attend_lecture retorna el string esperado (Valida en el mismo test con dos escenarios).
  • Agregar solution, que basicamente es el codigo del readme

self.specialization = specialization

def study(self, hours):
print(f"{self.name} is a high school student specializing in {self.specialization} and is studying for {hours} hours for exams.")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cambiar print por return

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done


2. Agrega un nuevo atributo llamado `major` para representar la carrera que están estudiando.

3. Modifica el método heredado `introduce` para imprimir este string:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Para imprimir retornar este string

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@@ -0,0 +1,46 @@
# `043` inheritance and polymorphism
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hacer los mismos cambios que en español

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@@ -0,0 +1,47 @@
# `043` inheritance and polymorphism
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Poner Inheritance con I mayuscula

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

self.major = major

def introduce(self):
print(f"Hi there! I'm {self.name}, a college student majoring in {self.major}.")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cambiar print por return

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

print(f"Hello! I am {self.name}, I am {self.age} years old, and my current grade is {self.grade}.")

def study(self, hours):
print(f"{self.name} is studying for {hours} hours.")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cambiar print por return

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

self.grade = grade

def introduce(self):
print(f"Hello! I am {self.name}, I am {self.age} years old, and my current grade is {self.grade}.")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cambiar print por return

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

print(f"Hi there! I'm {self.name}, a college student majoring in {self.major}.")

def attend_lecture(self):
print(f"{self.name} is attending a lecture for {self.major} students.")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cambiar print por return

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Comment on lines 31 to 33
college_student = CollegeStudent("Alice", 20, 90, "Computer Science")
college_student.introduce()
college_student.study(3)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agregar print

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@alesanchezr alesanchezr merged commit dfbfb9b into 4GeeksAcademy:master Jan 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants