Answer and Explanation:
The ways in which a layered pattern make use of encapsulation and abstraction are as follows:
- This framework lays its focus mainly on the bundling of related functionalities inside an application into different layer that are vertically stacked over one another.
- Functionality in between each layer is related by common function or role.
- Communication in between the layers is clear and exact and is coupled loosely.
- Providing a layered structure to the application indirectly supports its maintainability and flexibility.
Encapsulation:
Since, features like data type, properties, methods or implementation while designing are not exposed at the boundary of the layer thus No assumptions are required for these features.
Abstraction:
The layered framework abstracts the entire system's view and provides adequate details for better understanding of the roles of each layer individually and the relation that exist between these layers.
Answer:
total = 0
items = int(input("Enter the number of items ordered: "))
for i in range(items):
price = float(input("Enter the price of item " + str(i+1) + ": "))
total += price
if total < 200:
total += (items * 10)
print("Bill is $" + str(total))
Explanation:
*The code is in Python.
Ask the user to enter the number of items ordered
Create a for loop that iterates depending on the number of items ordered. Inside the loop, ask the price of each item and add it to the total
After the loop, check the total. If it is smaller than 200, add 10 for each item to the total
Print the total
Answer:
The program to the given statement can be defined as follows:
Program:
//header file
#include <stdio.h> //defining header file
int main() //defining main method
{
int k; //defining integer variable k
for (k=1;k<=97;k++) //defining for loop
{
printf("*"); //print value asterisks
}
return 0;
}
Output:
*************************************************************************************************
Explanation:
Firstly, the headers file is included in the above C-language, and then the main method is described and all computations are performed with this method, which can be described as follows:
- Inside the main method, an integer variable k is declared.
- In the next line, the for loop is declared, which uses the variable k, which starts from 1 and ends when the value of k is less than equal to 97, inside the loop, it will print asterisks.
Explanation:
what kind of sprites do you mean?