Write a fragment of code that declares a variable, C/C++ Programming

(a) Write a fragment of code that declares a variable colSp of type ColourSpot, and then moves it to the point (3, -4), and sets its colour to Green.

(b) A function QU8 is specified below.

function QU8(s in ColourSpot) return in ColourSpot pre true.

post the state of the returned spot is as follows. (X + 2, Y, Red) if s has state (X, Y, Black). (X,Y + 1, Green) if s has state (X,Y, Red).
(X + 2,Y, Blue) if s h a s state {X,Y, Green). (X,Y + 1, Black) if s has s t a t e (X,Y, Blue).

(i) Suppose that, the variable colSp is of type ColourSpot and is in the s t a t e (3,-4, Green).
Use the specification of QU8 to determine the s t a t e of colSp after execution of the following code fragment.

colSp <- QU8(colSp)

colSp <- QU8(colSp)

colSp <- QU8(colSp)

colSp <- QU8(colSp)

(ii) Write code to implement the function QU8

(iii) Use the WorkPad to test the implementation of QU8 which you gave in part (ii). Four test cases are sufficient for your TMA answer. One of them should test an input spot in t h e state (3, 4, Green). Save the WorkPad file which you are using to test your implementation and include the contents of this file as pari of your Solution Document. Also, copy the contents of the Output Window that, you obtain when testing, and include this with your Solution Document.

Posted Date: 3/7/2013 1:52:08 AM | Location : United States

Related Discussions:- Write a fragment of code that declares a variable, Assignment Help, Ask Question on Write a fragment of code that declares a variable, Get Answer, Expert's Help, Write a fragment of code that declares a variable Discussions

Write discussion on Write a fragment of code that declares a variable
Your posts are moderated
Related Questions
hello i have about 15 hours the dead line I Need a program in c language that''s determine the router ip or the gateway ip of the current NIC example the router ip is:

Make QtAV Videoplayer simple integrateable for Qt Applications Project Description: I'm preparing an application for Windows and Mac using QtCreator. I want a videoplayer

What is conversion constructor? explain it .

Differentiate between the expression "++a" and "a++"? - With ++a, increment happens first on variable a, and resulting value is used. This is known as prefix increment. - Wi

write a program for convert numbers upto 9 to alphabet?Eg.now enter the inputis 666 means output is "0" lphabet

3 . Write a ā€˜Cā€™ program to accept any 3 digit integer number from the keyboard and display the word equivalent representation of the given number.

Byteland county is very famous for luminous jewels. Luminous jewels are used in making beautiful necklaces. A necklace consists of various luminous jewels of particular colour. Nec

drawbacks in assignments in engeenirng

Develop a Motion sensor in Altera control Project Description: I want a project written in c using Altera eclipse development tool, that controls a motion sensor ( SRF05 ) fr