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

Assignment Help:

(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.

#### Palindrome, Problem : Change to palindrome A palindrome is a string that r...

Problem : Change to palindrome A palindrome is a string that reads the same from both the ends. Given a string S convert it to a palindrome by doing character replacement. Your ta

#### 3, Write a program to find the area under the curve y = f(x) between x = a ...

Write a program to find the area under the curve y = f(x) between x = a and x = b, integrate y = f(x) between the limits of a and b. The area under a curve between two points can b

#### C program to find vowels , C Program to FIND VOWELS   void main() ...

C Program to FIND VOWELS   void main() {           char str[50];           int ac=0, ec=0, ic=0, oc=0, uc=0;           int i,stln,vc,word=1;           clrscr

#### Genetic disease, Many human diseases could be controlled by the knowledge o...

Many human diseases could be controlled by the knowledge of the gene’s structure and pattern. The human gene could be represented by four nucleotides. Each nucleotide is represente

#### Board colouring, board colouring program

board colouring program

program

#### Virtual destructor, What about Virtual Destructor? describe it.

What about Virtual Destructor? describe it.

#### Define polymorphism?, Define Polymorphism? A: Polymorphism let a client ...

Define Polymorphism? A: Polymorphism let a client to treat distinct objects in the similar way even if they were developed from distinct classes and exhibit different behaviors.

#### Write a program that allows two players to play connect four, You may work ...

You may work in pairs for this assignment. Submit only one project per team; both partners will receive the same grade. Also, you can earn up to 40 points (out of 25) on this assig

#### Left in the lurch, Hey vrcoder I have got similar way but the game builder ...

Hey vrcoder I have got similar way but the game builder has sent me the game unfinished and left. I saw it on a link on line but they have wiped the old message with the link in it