Challenge: Computer parts #
You are making an app for a client. The client is a local computer store and repair business. They figured that they could cut costs if they had app to help them when building custom PCs. An app that can help them keep track of the parts and figure out which parts they need.
Come up with a class hierarchy for assembling computer parts.
Such that:
- The configurations you can make actually makes sense.
- It is easy to understand the configuration.
Here is a crude example with cars:
class Car {
String model;
int wheels;
int doors;
Engine engine;
Car(this.model, {required this.doors, this.wheels = 4, required this.engine});
}
class Engine {}
class V6 extends Engine {}
class V8 extends Engine {}
void main() {
Car("Golf", doors: 4, engine: V6());
}
If you haven’t built a computer before, then here are some pointers to get you started.
Motherboard is what all other components are connected to. It got:
- CPU socket
- CPU
- Brand (Intel, AMD)
- Number of cores
- Model
- CPU
- DIMM slots for RAM
- Type (DDR3, DDR4, DDR5)
- Clock frequency
- Capacity
- PCIe for expansion cards
- Graphics card
- Brand (Nvidia, AMD, Intel)
- Model
- Memory
- Cores
- Network (Wi-Fi, ethernet)
- Graphics card
- M.2 for SSD
- SATA for HDD, SSD and optical drives
- PSU for power
Not need to support old legacy configurations since customers won’t be buying them anyway.
Write your code on DartPad or in Android Studio