I need help

fong_11

Cadet
hi,
i was given this assignment for computer engineering for programming a sevenseg calculator on this program called MACOOT or MAC something Oriented Turing. I have all the components and stuff but i can't get it to work, I think i have things in the wrong place...please help

below is what i've got:
procedure horiz (x, y : int)
drawline (x, y, x + 5, y + 5, 52)
drawline (x, y, x + 5, y - 5, 52)
drawline (x + 5, y + 5, x + 35, y + 5, 52)
drawline (x + 5, y - 5, x + 35, y - 5, 52)
drawline (x + 35, y + 5, x + 40, y, 52)
drawline (x + 35, y - 5, x + 40, y, 52)
drawfill (x + 10, y, 52, 52)
end horiz

procedure vert (x, y : int)
drawline (x, y, x - 5, y + 5, blue)
drawline (x, y, x + 5, y + 5, blue)
drawline (x - 5, y + 5, x - 5, y + 35, blue)
drawline (x + 5, y + 5, x + 5, y + 35, blue)
drawline (x - 5, y + 35, x, y + 40, blue)
drawline (x + 5, y + 35, x, y + 40, blue)
drawfill (x, y + 10, blue, blue)
end vert

procedure numbers (num, x, y : int)

if num = 8 then
horiz (x, y)
horiz (x, y + 40)
horiz (x, y + 80)
vert (x, y)
vert (x, y + 40)
vert (x + 40, y)
vert (x + 40, y + 40)
elsif num = 1 then
vert (x + 40, y)
vert (x + 40, y + 40)
elsif num = 2 then
horiz (x, y)
horiz (x, y + 40)
horiz (x, y + 80)
vert (x + 40, y + 40)
vert (x, y)
elsif num = 3 then
horiz (x, y)
horiz (x, y + 40)
horiz (x, y + 80)
vert (x + 40, y)
vert (x + 40, y + 40)
elsif num = 4 then
horiz (x, y + 40)
vert (x, y + 40)
vert (x + 40, y)
vert (x + 40, y + 40)
elsif num = 5 then
horiz (x, y)
horiz (x, y + 40)
horiz (x, y + 80)
vert (x, y + 40)
vert (x + 40, y)
elsif num = 6 then
horiz (x, y)
horiz (x, y + 40)
horiz (x, y + 80)
vert (x, y)
vert (x, y + 40)
vert (x + 40, y)
elsif num = 7 then
horiz (x, y + 80)
vert (x + 40, y)
vert (x + 40, y + 40)
elsif num = 9 then
horiz (x, y)
horiz (x, y + 40)
horiz (x, y + 80)
vert (x, y + 40)
vert (x + 40, y)
vert (x + 40, y + 40)
elsif num = 0 then
vert (x, y)
vert (x, y + 40)
vert (x + 40, y)
vert (x + 40, y + 40)
horiz (x, y)
horiz (x, y + 80)
end if
end numbers

procedure display (x, y, erase : int, str : string)
if erase = 0 then
drawfillbox (x, y, x + 40, y + 80, white)
else
drawfillbox (x, y, x + 40, y + 80, blue)
Text.LocateXY (x + 15, y + 15)
put str ..
end if
end display

procedure moveover
setscreen ("graphics:1000;700")
setscreen ("noecho")
var str : string := ""
var key : string (1)
var rightedge : int := 500
var wid : int := 50
var len : int
var y_height : int := 300
loop
getch (key)
exit when key = "-" or key = "+"
if key >= "0" and key <= "9" then
str := str + key
len := length (str)
for posn : 1 .. len
display (rightedge - (len - posn) * wid, y_height, 1, str (posn))
end for
end if
end loop
end moveover

var str: string
var str2 : string
var oper : string

var oper1, oper2, total : int
oper1 := strint (str)
oper2 := strint (str2)
if oper = "+" then
total := oper1 + oper2
elsif oper = "-" then
total := oper1 - oper2
end if
var totstr : string := intstr (total) % use sevenseg to display totstr
 
it's neither algebra or geometry, but there is some bases for that because I have to make a calculator that has sevenseg numbers and they have to fit with each other and a precise place when you arent given any points, beside x and y...so every number that is made relies on a single point (x,y)....the language that i am using isn't used a lot....it think it has something to do with object oriented turing....i figured out how to move the numbers over and start a new line...i just have to figure out how to add them...if anyone can help please do.
 
Back
Top