-
hi someone help pls
I have these questions which i can't get my head round. Can someone show me the workings and thus the answers PLEASE!
For the algorithm below, state the values of Total and Number that would be printed.
Start
Number !2
Total ! Number
While Number ≤ Total
Total ! Total + Number
Number ! Number * Number
End While
Print Total, Number
End
Total
Number
QUESTION 2
A computerised machine sorts fruit by weight. It uses a program that directs the fruit through three different gates according to weight. Below is a small segment of that program.
message ! “Fruit is undersized”
fruit_count ! 0
Repeat
good_fruit ! true
Close all gates
Input (fruit_weight)
If (fruit_weight > 30.00) then
Open (gate1)
fruit_count ! fruit_count + 1
Else
If (fruit_weight > 20.00) then
Open (gate2)
fruit_count ! fruit_count + 1
Else
good_fruit ! false
Open (gate3)
Endif
Endif
If not (good_fruit) then
Output (message)
Endif
Until eof ***end of fruit
Output (fruit_count)
a. Identify each variable shown in the table below as one of the following variable types: text, date, boolean, integer, floating point.
Variable Type
fruit_count
message
good_fruit
Can anyone help me here ... i've been working on this and looked at a few books? I need the workings pls?
Many thanks
-
Re: hi someone help pls
We're not going to do your homework so don't even bother. We will, however, help you through your questions as long as you can show some effort. We won't give you the answers but what have you done so far? What don't you understand?
If you're only looking for someone to give you the answers then I'd suggest studying or dropping the class as you won't learn anything with the answers handed to you.