Answer:
The solution code is written in Python 3:
Explanation:
Firstly, use input function to ask user to enter total number of calories and fat in grams (Line 1-2)
Next we do the first input validation to check if the calories and fats are more than 0 (Line 4). If so apply formula to calculate calories from fats. If not, print error input message (Line 5, 13)
Then we proceed to next input validation to check if calories from fact more than total calories. If so, proceed to calculate percentage of calories from fats and if it is lower than 30%, display the appropriate message (Line 6 - 9). If fail the second input validation, the program will display another error input message again (Line 11)