Answer:
<u>Algorithm()
</u>
1. p = Enter the price of item A.
2. c = Enter the number of A’s purchased.
3. Now the price per item with tax is:
t= p+(p*6/100)
4. The total cost of c items:
ct= t * c.
5. Print ct.
In this algorithm, we are taking the price per item and counting it’s cost including tax. Then we are multiplying the price per item with tax with the number of items we purchase, to find the overall cost with tax.
You may calculate the overall cost without tax as (p*c). Then you can find the overall cost with tax as ((p*c)+(p*c*6/100)), as in both way, we will get the same result.
Answer:
Automatic and Explicit Buffering.
In the case of explicit buffering, the length of the queue is provided while in automatic buffering the queue size needs to be indefinite. In automatic buffering there is no need to block the sender while coping the message. While in explicit buffering the sender is blocked for the space in queue.
No memory is being wasted in explicit buffering.
Send by Copy and Send by Reference.
By using the send by copy method, the receiver is not able to change the state of parameter while send by reference allow. The advantage of using the send by reference method is that it allows to change a centralized application to its distributed version.
Fixed-sized and Variable-sized Messages.
In fixed size messaging refers, the buffer size is fixed. This means only a particular number of messages can only be supported by the fixed size buffer. The drawback of the fixed size messages is that they must be a part of fixed size buffer. These are not a part of variable size buffer. The advantage of variable size message is that the length of the message is variable means not fixed. The buffer length is unknown. The shared memory is being used by the variable size messages.
Explanation:
A Label is perfect for static text.
Answer:
if(revenue.cents - expenses.cents < 0){
profit.dollars = revenue.dollars - expenses.dollars - 1;
profit.cents = 1 - revenue.cents - expenses.cents;
}
else{
profit.dollars = revenue.dollars - expenses.dollars;
profit.cents = revenue.cents - expenses.cents;
}
Explanation:
We know that profit is given as: revenue - expenses from the question.
From the given expression above;
if(revenue.cents - expenses.cents < 0)
then profit.dollar will be revenue.dollars - expenses.dollars - 1; the 1 is to be carry over to the cent part. And the profit.cent will be 1 - revenue.cents - expenses.cents;
else the profit.dollars and the profit.cent is computed directly without needing to carry over:
profit.dollars = revenue.dollars - expenses.dollars;
profit.cents = revenue.cents - expenses.cents;