# You are designing a new syntax for a programming language like Java, with the intention of making

## Question:

You are designing a new syntax for a programming language like Java, with the intention of making it more approachable to students by using English words instead of punctuation symbols. (a) How does an HCI designer use a theory of human behaviour in their design practice? [2 marks] (b) What is an empirical method? Give an example and short description of that method. [3 marks] (c) Describe in terms of the Cognitive Dimensions two trade-offs involved between the existing Java syntax and the new proposed syntax. [8 marks] (d) How does the programming environment relate to this analysis? [2 marks] (e) A manager makes a proposal to try different permutations of syntaxes and measure students' performance using each permutation. How would you measure and compare the students' performance? [2 marks] (f ) What are the likely strengths and weaknesses of the approach in Part (e)? [3 marks]

(a) What are the principal characteristics of a linked list? [2 marks] (b) Consider a stack that consists solely of characters. A linked list can be used to model such a stack and a programmer has embarked on a class ChLink which begins thus: class ChLink { private char val; private ChLink next; public ChLink() { this.val = [1 mark] (c) Augment class ChLink with two methods push(char) which pushes a character onto the stack and a method pop() which returns the character at the top of the stack and, unless it is backstroke, removes that character from the stack. It is not possible to pop the bottom marker. [10 marks] (d) Write a test program which uses class ChLink to verify that a sequence of square brackets is properly nested. The test program might begin thus: public class ChLinkEx { public static void main(String[] args) { char[] chseq k(); for (int i=0; i

(a) Show how you would create Java array of 1000 integer values. [1 mark] (b) The values in an array could be used to represent digits in the decimal representation of a number. For example, the number 1 7 has decimal representation 0.142857 . . . and that could be stored in an array whose elements started {1, 4, 2, . . .}. For a number stored that way write code that multiplies the number by a given integer, returning the whole number part of the result and leaving the array updated to hold the fractional part of the product. [5 marks] (c) To convert a fraction to a representation base 16 (i.e. hexadecimal) you can multiply it by 16, and the resulting integer part is the first digit of the base-16 representation. Multiplying the fraction left over by 16 gets the second digit and so on. Write method that accepts an array of digits (base 10) and creates and returns a new array representing the same fraction but now base 16. Your code should work for any length input array, not just one of length 1000, and you may make the output array have the same length as your input array. [6 marks] (d) Suppose the input to your method in part (c) was of length 1000 and started off with the decimal digits of 1 7 in it. Although the initial digits in the output array are the correct hexadecimal representation of 1 7 the last few end up looking odd. Explain. [3 marks] (e) One way to ensure that numerical results are correct is to use interval arithmetic. A value is represented as a pair of arrays, one representing a number less than (or equal to) the true value and one a value greater than it. So if using 6 decimal places the number 1 7 would be held as a pair the two final digits differ by at most 1 then the smaller of them can be viewed as fully accurate. Using this idea, write code that accepts a fraction in decimal form and returns a vector denoting the same value in another base n (now no longer necessarily 16) such that all the digits in the result vector are correct. Clarity in your code is to be preferred to performance, but if you are aware of particular ways in which the code you present is particularly inefficient, you should note and explain them

For each of the following pairs of concepts that are used in Java explain similarities and differences and discuss when you would use one rather than the other. If there are important syntactic differences, method names, degrees of generalisation possible or the like, then any code fragments you give in illustration should be as short as possible to make the desired point. (a) JApplet and simple Java applications [4 marks] (b) Vector and arrays of strings (String []) [3 marks] (c) class, abstract class and interface

(a) In order to remove the overhead of a function call, a programmer decides to replace all calls to a function f with the macro F, where f and F are defined as follows: int f(int x) { return x+x;} #define F(X) (X)+(X) (i) Give two valid C expressions involving f which produce different results when F is substituted for f. Justify your answer. [4 marks] (ii) State the C language feature which can be used to correctly remove the overhead of a function call. [1 mark] (b) Consider the following: static struct link { int v; struct link *next; } *head=0; void convert(int a[], int len); Write function definition for convert which updates head to point to a linked-list containing the elements of a in the same order. You may assume len contains the number of elements in a. [5 marks] (c) Consider the following C++ declaration: template int SumSquares(); (i) Using function specialisation, provide an implementation of SumSquares so that, given an integer N, SumSquares() returns: X N i=1 i 2 [5 marks] (ii) Compare and contrast the functionality of the C preprocessor and the C++ template system. Explain why it is not possible to write a C preprocessor macro to implement SumSquares. [5 marks]

(a) An author writes: Most successful language design efforts share three important characteristics . . . 1. Motivating Application: The language was designed so that a specific kind of program could be written more easily. 2. Abstract Machine: There is a simple and unambiguous program execution model. 3. Theoretical Foundations: Theoretical understanding was the basis for including certain capabilities and omitting others. Briefly discuss the merits and/or shortcomings of one of the above three statements of your choice, giving examples and/or counterexamples from procedural, applicative, logical, and/or object-oriented programming languages. [6 marks] (b) For two programming languages of your choice amongst FORTRAN, Algol, Pascal and C, briefly discuss and evaluate their typing disciplines. Further compare the advantages and disadvantages that their designs impose on the programmer. [5 marks] (c) Consider the following two program fragments. ( defvar x 1 ) ( defun g(z) (+ x z) ) ( defun f(y) (+ (g 1) ( let ( ( x (+ y 3) ) ) ( g(+ y x) ) ) ) ) ( f 2 ) val x = 1 ; fun g(z) = x + z ; fun f(y) = g(1) + let val x = y + 3 in g(y+x) end ; f(2) ; What are their respective output values when run in their corresponding interpreters? Justify your answer, explaining it in a conceptual manner. [4 marks] (d) Outline the key features that a language must have to be called object-oriented. Further, briefly discuss to what extent one programming language of your choice amongst Simula, Smalltalk, C++, and Java has them. [5 marks

(a) Many computer scientists believe that languages with strong compile-time type checking are better than those that are typeless, dynamically typed, or are weakly type checked. Discuss the reasons for this view. [7 marks] (b) If strictly-checked data types are seen as good, discuss whether augmenting a language with many more primitive data types is better. Consider, in particular, the possibility of incorporating into a language such as Java many new numerical types such as packed decimal of various precisions, scaled arithmetic, and new types to hold values representing distance, mass and time. How would these additions affect the readability and reliability of programs? [7 marks] (c) Some languages allow different modes of calling of function arguments, such as call by value, call by reference and call by name. Discuss the advantages and disadvantages of incorporating the argument calling modes into the data types of functions. [6 marks]

(*a*) State what is meant by a *directed graph *and a *strongly connected component*.

Illustrate your description by giving an example of such a graph with 8 vertices

and 12 edges that has three strongly connected components. [5 marks]

(*b*) Describe, in detail, an algorithm to perform a depth-fifirst search over such a

graph. Your algorithm should attach the discovery and fifinishing times to each

vertex and leave a representation of the depth-fifirst spanning tree embedded

within the graph. [5 marks]

(*c*) Describe an *O*(*n*) algorithm to discover all the strongly connected components

of a given directed graph and explain why it is correct. You may fifind it useful

to use the concept of the forefathepath

from *v *to *u*. [10 marks]

2 Computer Design

(*a*) What is a *data cache *and what properties of data access does it exploit?

[5 marks]

(*b*) What is a *direct mapped cache *and under what conditions will it exhibit poor

performance? [5 marks]

(*c*) Under what circumstances might a word of data in main memory be

simultaneously held in two separate fifirst-level cache lines? [5 marks]

(*d*) A *translation look aside buffffer *is a specialised cache. What does it typically

store and why is it often a factor of 1000 smaller than a data cache? [5 marks]

2CST.2001.6.3

3 Digital Communication I

(*a*) Defifine the terms *circuit *and *packet *in the context of communication systems.

[5 marks]

(*b*) What sort of guarantee does circuit switching provide? [5 marks]

(*c*) What advantages does packet switching provide over circuit switching?

[5 marks]

(*d*) Which of *frequency division multiplexing*, *time division multiplexing *and *code*

*division multiplexing *lend themselves to circuit switching? Which to packet

switching? Explain why or why not in each case. [5 marks]

4 Computer Graphics and Image Processing

(*a*) Describe the *z*-buffffer polygon scan conversion algorithm. [10 marks]

(*b*) In ray tracing, once we have determined where a ray strikes an object, the

illumination at the intersection point can be calculated using the formula:

*I *= *Iaka *+X

*i*

*Iikd*(L*i *N) +X

*i*

*Iiks*(R*i *V)*n*

Explain what real effffect each of the three terms is trying to model and explain

what each of the following symbols means, within the context of this formula:

*I, Ia, i, Ii , ka, kd, ks,*L*i, *N*, *R*i, *V*, n*

[10 marks]

3

[TURN OVERCST.2001.6.4

SECTION B

5 Comparative Programming Languages

(*a*) Brieflfly explain the concept of coroutines as used in BCPL and outline

the effffect of the library functions createco(f, size), deleteco(ctpr),

callco(cptr, val) and cowait(val). [10 marks]

(*b*) Outline how you would design a coroutine to merge, in increasing order, two

infifinite streams of increasing integers supplied by two other coroutines.

[5 marks]

(*c*) Brieflfly outline how you would implement an analogous merging mechanism in

an object-oriented language, such as Java, that does not provide a coroutine

mechanism. [5 marks]

6 Compiler Construction

(*a*) Describe one possible structure (e.g. ELF) of an object fifile. Illustrate your

answer by considering the form of object fifile which might result from the

following C program.

int a = 1, b = -1;

extern int g(int);

extern int c;

int f() { return g(a-b) + c; }

It is not necessary to consider the exact instruction sequence, just issues

concerning its interaction with the object fifile format. [10 marks]

(*b*) Describe how a linker takes a sequence of such programs and produces an

executable fifile. [4 marks]

(*c*) Compare and contrast *static *and *dynamic *linking in a system using your object

fifile format. [6 marks]

4CST.2001.6.5

7 Prolog for Artifificial Intelligence

A weighted binary tree can be defifined using compound terms in the following way.

A node of the tree is represented by the term *n*(*V, L, R*), where *V *stands for the

value of the node, and *L *and *R *stand for the left and right branches, respectively.

A terminal node has the *R *and *L *components instantiated to the null list.

Given an input tree *T*, write a Prolog program that constructs a tree of the same

shape as *T*, but in which the value of each node has been set to the value of the

maximum value node in *T*.

[Note: Maximum marks are available only for programs that perform this task in

one recursive descent of the input tree, and which use no more than four clauses.]

[20 marks]

5

[TURN OVERCST.2001.6.6

8 Databases

The environmental agency is setting up an SQL database to monitor long-term

trends in the climate. Data are collected from observatories of a number of difffferent

kinds.

Flood risk is of particular concern. Each water authority measures river levels and

rates of flflow hourly at major points, and records reservoir levels daily.

In addition, the agency maintains weather stations both inland and at sea. These

record precipitation (rainfall etc.), temperature, sunshine, air pressure and wind.

Values of new precipitation, temperature, pressure, and wind speed and direction

are taken hourly; gusts of over 60 m.p.h. are noted whenever they occur.

Maximum and minimum temperature and pressure, the total number of hours of

sunshine and the total precipitation are recorded daily. Inland stations can be

grouped by water authority.

By default these primary data will be relegated to archive after 2 years. Selected

information is retained permanently in a data warehouse. This serves two purposes.

First, it holds monthly summary data consisting of the maximum (and minimum

as appropriate) day value for each statistic, together with the monthly totals of

sunshine and precipitation. The warehouse also keeps detailed information relating

to periods of extreme weather from the relevant observatories, with one or more

keywords describing the nature of the incident (*flflood*, *blizzard*, *hurricane *etc.) and

an optional comment.

Write notes to assist in the design of the schema for the relational data warehouse,

including any diagrams that you fifind helpful. Explain how your design will enable

meteorologists to fifind relevant past records, noting any assumptions that you make

about the nature of the data.

[You should not go into unnecessary detail about the structure of the primary

database. You may assume that expert meteorologists will select the data for the

warehouse.]

[20 marks]

6CST.2001.6.7

SECTION C

9 Semantics of Programming Languages

Write short notes on *four *of the following fifive topics.

(*a*) The relationship between three forms of operational semantics of the Language

of Commands (LC) given by

* *an evaluation relation *h P, si hV, s0 i*

* *a transition relation *h P, si hP0 , s0 i*

* *a transition relation between the confifigurations

*h c, r, si *of the

SMC-machine

(*b*) The notion of *semantic equivalence *of LC phrases and its congruence property.

(*c*) *Call-by-name *and *call-by-value *rules for evaluating function applications in the

Language of Functions and Procedures (LFP) and the relationship between the

evaluation relations for LFP based upon each of them.

(*d*) The notion of *bisimilarity *of two confifigurations in a labelled transition system.

(*e*) The rules defifining the possible labelled transitions of parallel composition

(*P*1*|P*2) and restriction (* c . P*) in the Language of Communicating Processes

(LCP).

[5 marks each]

7

[TURN OVERCST.2001.6.8

10 Foundations of Functional Programming

The following are some concepts that have flflourished in the context of functional

programming but which have (so far) been less heavily used in main-stream

languages even when they have been available:

(*a*) polymorphic types

(*b*) type reconstruction

(*c*) higher-order functions

(*d*) lazy evaluation

(*e*) continuations

For *each *case give a brief explanation of the facility referred to, suggest a

circumstance in which it might be useful and comment on how immediately relevant

to non-functional languages it seems.

[4 marks per part]

8CST.2001.6.9

11 Logic and Proof

(*a*) In the context of clause-based proof methods, defifine the notion of *pure literal*

and describe what should be done if the set of clauses contains pure literals.

[3 marks]

(*b*) Use the Davis-Putnam method to discover whether the following set of clauses

is satisfifiable. If they are satisfifiable, show a satisfying interpretation.

*{P, R} {P, R} {P, Q} {Q, R} {P, Q, R}*

[6 marks]

(*c*) The three-fifingered inhabitants of the planet Triterra build base-3 computers.

A Triterran named Randal Tryant has found a way of verifying base-3

combinational logic. His Ordered Ternary Decision Diagrams (OTDDs) are

the same as a technology used on planet Earth except that all variables and

expressions range over the values 0, 1 and 2 instead of just 0 and 1.

(*i*) Describe how a full ternary decision tree can be reduced to an OTDD

without regard for effiffifficiency. [2 marks]

(*ii*) Sketch an effiffifficient algorithm to convert a ternary expression directly to an

OTDD without constructing the full decision tree. For a typical ternary

connective use modulo-3 multiplication, written as . [6 marks]

(*iii*) Demonstrate your algorithm by applying it to the ternary expression

((*i i*) * j*) * *2. [3 marks]

9

[TURN OVERCST.2001.6.10

12 Complexity Theory

(*a*) Show that any language that can be accepted by a nondeterministic machine

in *time f*(*n*) can also be decided by a deterministic machine in *space O*(*f*(*n*)).

[4 marks]

(*b*) Show that any language that can be accepted by a nondeterministic machine

in *space f*(*n*) can also be decided by a deterministic machine in *time*

*O*(*c*(*f*(*n*)+log *n*) ), for some constant *c*. [6 marks]

(*c*) Explain what the above results tell us about the inclusion relationships among

the complexity classes:

NL, co-NL, P, NP, PSPACE and NPSPACE

[4 marks]

(*d*) It has been proved that the graph reachability problem is in co-NL. What

further inclusions can you derive among the above complexity classes using

this fact? Explain your answer.

(*a*) State what is meant by a *directed graph *and a *strongly connected component*.

Illustrate your description by giving an example of such a graph with 8 vertices

and 12 edges that has three strongly connected components. [5 marks]

(*b*) Describe, in detail, an algorithm to perform a depth-fifirst search over such a

graph. Your algorithm should attach the discovery and fifinishing times to each

vertex and leave a representation of the depth-fifirst spanning tree embedded

within the graph. [5 marks]

(*c*) Describe an *O*(*n*) algorithm to discover all the strongly connected components

of a given directed graph and explain why it is correct. You may fifind it useful

to use the concept of the forefather (*v*) of a vertex *v *which is the vertex, *u*,

with highest fifinishing time for which there exists a (possibly zero length) path

from *v *to *u*. [10 marks]

2 Computer Design

(*a*) What is a *data cache *and what properties of data access does it exploit?

[5 marks]

(*b*) What is a *direct mapped cache *and under what conditions will it exhibit poor

performance? [5 marks]

(*c*) Under what circumstances might a word of data in main memory be

simultaneously held in two separate fifirst-level cache lines? [5 marks]

(*d*) A *translation look aside buffffer *is a specialised cache. What does it typically

store and why is it often a factor of 1000 smaller than a data cache? [5 marks]

2CST.2001.6.3

3 Digital Communication I

(*a*) Defifine the terms *circuit *and *packet *in the context of communication systems.

[5 marks]

(*b*) What sort of guarantee does circuit switching provide? [5 marks]

(*c*) What advantages does packet switching provide over circuit switching?

[5 marks]

(*d*) Which of *frequency division multiplexing*, *time division multiplexing *and *code*

*division multiplexing *lend themselves to circuit switching? Which to packet

switching? Explain why or why not in each case. [5 marks]

4 Computer Graphics and Image Processing

(*a*) Describe the *z*-buffffer polygon scan conversion algorithm. [10 marks]

(*b*) In ray tracing, once we have determined where a ray strikes an object, the

illumination at the intersection point can be calculated using the formula:

*I *= *Iaka *+X

*i*

*Iikd*(L*i *N) +X

*i*

*Iiks*(R*i *V)*n*

Explain what real effffect each of the three terms is trying to model and explain

what each of the following symbols means, within the context of this formula:

*I, Ia, i, Ii , ka, kd, ks,*L*i, *N*, *R*i, *V*, n*

[10 marks]

3

[TURN OVERCST.2001.6.4

SECTION B

5 Comparative Programming Languages

(*a*) Brieflfly explain the concept of coroutines as used in BCPL and outline

the effffect of the library functions createco(f, size), deleteco(ctpr),

callco(cptr, val) and cowait(val). [10 marks]

(*b*) Outline how you would design a coroutine to merge, in increasing order, two

infifinite streams of increasing integers supplied by two other coroutines.

[5 marks]

(*c*) Brieflfly outline how you would implement an analogous merging mechanism in

an object-oriented language, such as Java, that does not provide a coroutine

mechanism. [5 marks]

6 Compiler Construction

(*a*) Describe one possible structure (e.g. ELF) of an object fifile. Illustrate your

answer by considering the form of object fifile which might result from the

following C program.

int a = 1, b = -1;

extern int g(int);

extern int c;

int f() { return g(a-b) + c; }

It is not necessary to consider the exact instruction sequence, just issues

concerning its interaction with the object fifile format. [10 marks]

(*b*) Describe how a linker takes a sequence of such programs and produces an

executable fifile. [4 marks]

(*c*) Compare and contrast *static *and *dynamic *linking in a system using your object

fifile format. [6 marks]

4CST.2001.6.5

7 Prolog for Artifificial Intelligence

A weighted binary tree can be defifined using compound terms in the following way.

A node of the tree is represented by the term *n*(*V, L, R*), where *V *stands for the

value of the node, and *L *and *R *stand for the left and right branches, respectively.

A terminal node has the *R *and *L *components instantiated to the null list.

Given an input tree *T*, write a Prolog program that constructs a tree of the same

shape as *T*, but in which the value of each node has been set to the value of the

maximum value node in *T*.

[Note: Maximum marks are available only for programs that perform this task in

one recursive descent of the input tree, and which use no more than four clauses.]

[20 marks]

5

[TURN OVERCST.2001.6.6

8 Databases

The environmental agency is setting up an SQL database to monitor long-term

trends in the climate. Data are collected from observatories of a number of difffferent

kinds.

Flood risk is of particular concern. Each water authority measures river levels and

rates of flflow hourly at major points, and records reservoir levels daily.

In addition, the agency maintains weather stations both inland and at sea. These

record precipitation (rainfall etc.), temperature, sunshine, air pressure and wind.

Values of new precipitation, temperature, pressure, and wind speed and direction

are taken hourly; gusts of over 60 m.p.h. are noted whenever they occur.

Maximum and minimum temperature and pressure, the total number of hours of

sunshine and the total precipitation are recorded daily. Inland stations can be

grouped by water authority.

By default these primary data will be relegated to archive after 2 years. Selected

information is retained permanently in a data warehouse. This serves two purposes.

First, it holds monthly summary data consisting of the maximum (and minimum

as appropriate) day value for each statistic, together with the monthly totals of

sunshine and precipitation. The warehouse also keeps detailed information relating

to periods of extreme weather from the relevant observatories, with one or more

keywords describing the nature of the incident (*flflood*, *blizzard*, *hurricane *etc.) and

an optional comment.

Write notes to assist in the design of the schema for the relational data warehouse,

including any diagrams that you fifind helpful. Explain how your design will enable

meteorologists to fifind relevant past records, noting any assumptions that you make

about the nature of the data.

[You should not go into unnecessary detail about the structure of the primary

database. You may assume that expert meteorologists will select the data for the

warehouse.]

[20 marks]

6CST.2001.6.7

SECTION C

9 Semantics of Programming Languages

Write short notes on *four *of the following fifive topics.

(*a*) The relationship between three forms of operational semantics of the Language

of Commands (LC) given by

* *an evaluation relation *h P, si hV, s0 i*

* *a transition relation *h P, si hP0 , s0 i*

* *a transition relation between the confifigurations

*h c, r, si *of the

SMC-machine

(*b*) The notion of *semantic equivalence *of LC phrases and its congruence property.

(*c*) *Call-by-name *and *call-by-value *rules for evaluating function applications in the

Language of Functions and Procedures (LFP) and the relationship between the

evaluation relations for LFP based upon each of them.

(*d*) The notion of *bisimilarity *of two confifigurations in a labelled transition system.

(*e*) The rules defifining the possible labelled transitions of parallel composition

(*P*1*|P*2) and restriction (* c . P*) in the Language of Communicating Processes

(LCP).

[5 marks each]

7

[TURN OVERCST.2001.6.8

10 Foundations of Functional Programming

The following are some concepts that have flflourished in the context of functional

programming but which have (so far) been less heavily used in main-stream

languages even when they have been available:

(*a*) polymorphic types

(*b*) type reconstruction

(*c*) higher-order functions

(*d*) lazy evaluation

(*e*) continuations

For *each *case give a brief explanation of the facility referred to, suggest a

circumstance in which it might be useful and comment on how immediately relevant

to non-functional languages it seems.

[4 marks per part]

8CST.2001.6.9

11 Logic and Proof

(*a*) In the context of clause-based proof methods, defifine the notion of *pure literal*

and describe what should be done if the set of clauses contains pure literals.

[3 marks]

(*b*) Use the Davis-Putnam method to discover whether the following set of clauses

is satisfifiable. If they are satisfifiable, show a satisfying interpretation.

*{P, R} {P, R} {P, Q} {Q, R} {P, Q, R}*

[6 marks]

(*c*) The three-fifingered inhabitants of the planet Triterra build base-3 computers.

A Triterran named Randal Tryant has found a way of verifying base-3

combinational logic. His Ordered Ternary Decision Diagrams (OTDDs) are

the same as a technology used on planet Earth except that all variables and

expressions range over the values 0, 1 and 2 instead of just 0 and 1.

(*i*) Describe how a full ternary decision tree can be reduced to an OTDD

without regard for effiffifficiency. [2 marks]

(*ii*) Sketch an effiffifficient algorithm to convert a ternary expression directly to an

OTDD without constructing the full decision tree. For a typical ternary

connective use modulo-3 multiplication, written as . [6 marks]

(*iii*) Demonstrate your algorithm by applying it to the ternary expression

((*i i*) * j*) * *2. [3 marks]

9

[TURN OVERCST.2001.6.10

12 Complexity Theory

(*a*) Show that any language that can be accepted by a nondeterministic machine

in *time f*(*n*) can also be decided by a deterministic machine in *space O*(*f*(*n*)).

[4 marks]

(*b*) Show that any language that can be accepted by a nondeterministic machine

in *space f*(*n*) can also be decided by a deterministic machine in *time*

*O*(*c*(*f*(*n*)+log *n*) ), for some constant *c*. [6 marks]

(*c*) Explain what the above results tell us about the inclusion relationships among

the complexity classes:

NL, co-NL, P, NP, PSPACE and NPSPACE

[4 marks]

(*d*) It has been proved that the graph reachability problem is in co-NL. What

further inclusions can you derive among the above complexity classes using

this fact? Explain your answer.

Design a class named Pet, which should have the following fields: Name -The name field holds the name of a pet. Type - The type field holds the type of animal that is the pet. Example values are "Dog' Cat, and "Bird". Age-The age field holds the pet's age. The Pet class should also have the following methods: setName The setName method stores a value in the name field. setType- The setType method stores a value in the type field. setAge-The setAge method stores a value in the age field. getName The getName method returns the value of the name field. getType The getType method returns the value of the type field. getAge-The getAge method returns the value of the age field. Once you have designed the class, design a program that creates an objectof the class and prompts the user to enter the name, type, and age of his pet. This datashould be stored in the object. Use the object's accessor methods to retrieve the pet's name, type, and age and display this data on the screen. You are to submit, as a Microsoft Word Document, the following for this assignment: 1.Flowchart Class Petf I/Declare a Pet variable

**kindly answer all the questions**

**Related Book For**

## Managerial Economics and Business Strategy

ISBN: 978-0071267441

7th Edition

Authors: Michael R. baye