Answer:
The solution code is written in Python 3:
- calories = int(input("Enter number of calories: "))
- fats = int(input("Enter number of fat in grams: "))
-
- if(calories > 0 and fats > 0):
- cf = fats * 9
- if(cf < calories):
- percent = cf / calories
- if(percent < 0.3):
- print("Food is low in fat")
- else:
- print("Error input. Calories from fat cannot more than total calories")
- else:
- print("Error input. Calories and fats must be more than 0")
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)
C) Filters make it easier to find specific information in large databases.
Answer: designing the facility with architects.
Explanation: The programming phase of a facility construction has nothing to do with the architectural design of the facility. The programming phase usually involves ; Determining the needs of intended or impending users, estimated construction cost, required area for the project. The programming phase may involve individual or joint questioning or fact finding from the intended occupants or user group to determine their needs in terms of systems and infrastructure, security and so on. It also gets intended occupants informed on the features, use and design of the intended project. It also examines the effect of the project on structures previously existing in the environment.
Answer and Explanation:
Static variables are variables that still maintain their values outside the score which they are declared. They are declared with the static keyword
Example:
<em>static int score = 30;</em>
Local variables are variables whose scope are restricted to a block. Their values are restricted to the block which they are declared in.
Example:
<em>void abd(){</em>
<em>int score;</em>
<em>}</em>
<em>score is a local variable to abcd() function</em>