Automatic Multiplication and data processing

Hello Every one
i am stuck I have created a table for student performace but I want to enter only student’s mid semester marks and coursework which whose total is out of 40
then final exam whose total is out of 60
but I want the system to be able to calculate the student total marks by adding the CW + End o f semester
see image below

I want to be able to just input CW1 CATs the system adds themup and converts to 40%
then in in put End Sem the system converts bout of 60
finally the system adds the to final figures ie CW/40 plus End Sem60 to give the final student mark
how can I achieve this please

Do the math in the SQL select statement seems the simplest way to do it

any resources to show me how to do it