Answer:
I want to both code the program and design the electronic component, what major should I study?
It seems, you like Embedded systems. I Suggest you study Electronics and Communication Engineering.
Electronics Engineering courses such as Microprocessors, Embedded systems, Object oriented programming, Digital Signal Analysis, Digital signal processing, etc. will help you learn Hardware programming. Courses such as Electronic Devices and circuits, Electrical Engineering Materials, Advanced Electronics, Control Systems, Instrumentation systems, etc. will help you in hardware design.
The course name varies with the university. you may find the following:
Electronics and Communication Engineering
Electronics and Electrical Engineering
Electrical and Computer Engineering
Electronics and Communication Engineering, etc.