{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Steven_Barry_Week5_CP - write"no prices entered...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
I was a little confused on this one but this is what I came up with: Declare count as integer Declare sum as real Declare price as real Declare x as real Declare y as real Declare z as real set count = 0 set sum = 0 write "enter home price, enter 0 when complete." input price while price <> 0 do count = count + 1 sum = sum + price n(count) = price write "enter home price, enter 0 when complete." input price end while if count = 0 then
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: write "no prices entered - program ends" endif else for x = 1 to count -1 for y = x+1 to count if price(x) > price(y) then set temp = price(x) set price(x) = price(y) set price(y) = temp endif else next y next x set z = count/2 if mod(z) = 0 then Median = (price(z)+price(z+1))/2 else Median = price(int(z+1)) Write, “The median price of homes in Botany Bay during 2002 was:” Median endif...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online