
Programming Help
Hey everyone, I have a JAVA program due tomorrow and I'm soo stressed out with it. I've been working on it for hours now and have like nothing to show for it, if anyone could help me that would be AWESOME! here is the program details:
With x and y being (possibly empty) sequences, ~ the concatenation operator, and () an empty sequence, the operations on sequences are defined as follows:
{true} CreateSeq (x) {x = ()}
{x = (c)~y} a := First (x) {a = c AND x = (c)~y}
{x = (c)~y} GetFirst (x, v) {v = c AND x = y}
{x = y~(c)} GetLast (x, v) {v = c AND x = y}
{x = y} PutFirst (x, c) {x = (c)~y}
{x = y} PutLast (x, c) {x = y~(c)}
{x = X} SeqIsMT (x) {SeqIsMT (x) = (X = ())}
a) Implement a sequence class in javac. Please implement all seven operations defined above.
b) Using this sequence class, solve the following problem. The input is a textstring containing alfabetical characters as well as {, }, (, ), [ and ] characters. Check the input to see if each open and closebracket is matched.
An example is given here:
(({A}bc{D})[ef])g
is correct because each pair of brackets encloses a correct substring. More examples:
((a)} is not correct
a is correct
{} is correct
)( is wrong
(a)} is not correct
c) Test your implementation using the following test cases:
(({A}bc{D})[ef])g
(((((A)(bcd))))
{[({[(a)]})]}
()
Also test on an empty text string.
Thanks a lot, John
Posting Permissions
 You may not post new threads
 You may not post replies
 You may not post attachments
 You may not edit your posts

Forum Rules

Development Centers
 Android Development Center
 Cloud Development Project Center
 HTML5 Development Center
 Windows Mobile Development Center
