• We need your support!

    We are currently struggling to cover the operational costs of Xtremepapers, as a result we might have to shut this website down. Please donate if we have helped you and help make a difference in other students' lives!
    Click here to Donate Now (View Announcement)

Computer studies ! Post your doubts here =)

Status
Not open for further replies.
Messages
1,824
Reaction score
949
Points
123
multiply dont add *

I was still editing it .. check again .. And yes we are to include m=milk to tell the examiner what m stands for !!

but i would suggest to do it like this ..

m=0 (milk)
y=0 (yoghurt)

and so on.
 
Messages
40
Reaction score
5
Points
18
plz can anyone help me out to explain what is actually real time transaction and what is real time process control n wat is diffrnce bw them? pllllllllzzzzzzzzzzz
 
Messages
1,824
Reaction score
949
Points
123
Total = 0 (Total Price)
TotalItems = 0 (Total Number Of Items)

REPEAT
Input Item
Read Item
If Item = Milk, than Total = Total +2
If Item = Yogurt, than Total = Total +2.5
If Item = fresh cream, than Total = Total +4
If Item = butter then Total = Total+1
Else Print "Item Not In List"
TotalItems = TotalItems + 1
UNTILL Item = END

If Total > 10 then Total*0.9

Output "Amount In $:" Total
Output "Items Purchased:" TotalItems


Check mine guys .. is it right ?? ^^ Mark it out of 8...
 
Messages
389
Reaction score
147
Points
53
plz can anyone help me out to explain what is actually real time transaction and what is real time process control n wat is diffrnce bw them? pllllllllzzzzzzzzzzz

real time transaction involves transaction such as giving money and recieving something on the spot
while real time process control means sensors are involved in maintaining the process...
 
Messages
389
Reaction score
147
Points
53
milk = 0
yogurt = 0
fresh cream = 0
butter = 0
count = 1

For count = 1 to n
input item

If item = milk
Then milk = milk + 1

ElseIf item = yogurt
Then yogurt = yogurt + 1

ElseIf item = fresh cream
Then fresh cream = fresh cream + 1

ElseIf item = butter
Then butter = butter + 1

Else Print 'Error'

EndIf

count = count + 1

Next count

Total = 2 * milk + 2.5 * yogurt + 4 * fresh cream + 1 * butter

If Total > 10
Then
Total = 90% * Total

Print Total
Print n


this one is completely correct !!
 
Messages
1,824
Reaction score
949
Points
123
milk = 0
yogurt = 0
fresh cream = 0
butter = 0
count = 1

For count = 1 to n
input item

If item = milk
Then milk = milk + 1

ElseIf item = yogurt
Then yogurt = yogurt + 1

ElseIf item = fresh cream
Then fresh cream = fresh cream + 1

ElseIf item = butter
Then butter = butter + 1

Else Print 'Error'

EndIf

count = count + 1

Next count

Total = 2 * milk + 2.5 * yogurt + 4 * fresh cream + 1 * butter

If Total > 10
Then
Total = 90% * Total

Print Total
Print n


this one is completely correct !!

The loop here is endless ..

how will the computer know when to stop ?? .. n is not an integer, and how will the computer know that nth integer has arrived and it has to move on?

with these types of questions .. our teacher told us that we can only use REPEAT loop .. !!

7/8... Other than the loop everything is perfect!!
 
Messages
1,824
Reaction score
949
Points
123
Total = 0 (Total Price)
TotalItems = 0 (Total Number Of Items)

REPEAT
Input Item
Read Item
If Item = Milk, than Total = Total +2
If Item = Yogurt, than Total = Total +2.5
If Item = fresh cream, than Total = Total +4
If Item = butter then Total = Total+1
Else Print "Item Not In List"
TotalItems = TotalItems + 1
UNTILL Item = END

If Total > 10 then Total*0.9

Output "Amount In $:" Total
Output "Items Purchased:" TotalItems


someone please check my pseudocode!! and point out mistakes to me :(
 
Messages
389
Reaction score
147
Points
53
The loop here is endless ..

how will the computer know when to stop ?? .. n is not an integer, and how will the computer know that nth integer has arrived and it has to move on?

with these types of questions .. our teacher told us that we can only use REPEAT loop .. !!

7/8... Other than the loop everything is perfect!!

in question it is assumed to have n number of items , it isnt a mistake !!! in question the number of item is not given therefore it is assumed!!!
 
Messages
1,477
Reaction score
1,893
Points
173
The loop here is endless ..

how will the computer know when to stop ?? .. n is not an integer, and how will the computer know that nth integer has arrived and it has to move on?

with these types of questions .. our teacher told us that we can only use REPEAT loop .. !!

7/8... Other than the loop everything is perfect!!
n is any integer, dear

It may be 100, 200 or whatever
The loop would work perfectly fine, dont worry!

You can use For-next, Repeat-until or While-Do
Any loop used will be correct!
:)
 
Messages
1,824
Reaction score
949
Points
123
Total = 0 ( Total Amount)
m = 0 (Number of Milk)
y = 0 (Number of Yoghurt)
fc = 0 (Number of Fresh Cream)
b = 0 (Number Of Butter)

REPEAT
Input Item
READ Item
If Item = Yoghurt, then y=y+1
If Item=Fresh Cream then fc=fc+1
If Item=Butter, then b=b+1
If Item=Milk, then m=m+1
UNTILL Item = STOP

Total Items = (m+y+fc+b)
Amount = (2*m+2.5*y+4*fc+1*b)

Output "Total Items:" Total Items
Output "Price In $:" Amount
 
Status
Not open for further replies.
Top