Challenge: Compose a Computer Class
Swipe to start coding
Practice composition by building a Computer class that contains other component classes. In this task, you will implement a Computer class that holds references to CPU, RAM, and Storage objects as its fields.
- Add fields to the
Computerclass forCPU,RAM, andStorage. - Implement a constructor for
Computerthat takesCPU,RAM, andStorageobjects as parameters and assigns them to the corresponding fields. - Add a method
GetSpecs()to theComputerclass that returns a string combining the results of callingGetInfo()on each component.
Solución
¡Gracias por tus comentarios!
single
Pregunte a AI
Pregunte a AI
Pregunte lo que quiera o pruebe una de las preguntas sugeridas para comenzar nuestra charla
Can you explain this in simpler terms?
What are some examples related to this topic?
How does this information apply to real-world situations?
Genial!
Completion tasa mejorada a 4.17
Challenge: Compose a Computer Class
Desliza para mostrar el menú
Swipe to start coding
Practice composition by building a Computer class that contains other component classes. In this task, you will implement a Computer class that holds references to CPU, RAM, and Storage objects as its fields.
- Add fields to the
Computerclass forCPU,RAM, andStorage. - Implement a constructor for
Computerthat takesCPU,RAM, andStorageobjects as parameters and assigns them to the corresponding fields. - Add a method
GetSpecs()to theComputerclass that returns a string combining the results of callingGetInfo()on each component.
Solución
¡Gracias por tus comentarios!
single