Purchase Solution

Writing Pseudocode Statements With Different Variables

Not what you're looking for?

Ask Custom Question

1. Suppose myCar is the name of a class variable that references an object, and go is the name of a method. (The go method does not take any arguments.) Write a pseudocode statement that uses the myCar variable to call the method.

2. In pseudocode, write the first line fo the definition for a Poodle class. The class should extend the Dog class.

Look at the following pseudocode class definitions:
Class Plant
Public Module message()
Display "I'm a plant."
End Module
Class Tree Extends Plant
Public Module message()
Display "I'm a tree."
End Module
End Class
Given these class definitions, what will the following pseudocode display?
Declare Plant p
Set p = new Tree()
Call p.message()

3. 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. "Dog", "Cat", and "Bird"
age - The age field holds the pet's age

The Pet class should also have he following methods:
setName
setType
setAge
getName
getType
getAge

4. Design a class and a program that creates an object of the class and prompts the user to enter the name, type, and age of his or her pet. This data should be stored in the object. Use the object's accessor method to retrieve the pet's name, type, and age and display this data on screen.

5. Design a class that holds the following personal data: name, address, age, and phone number. Write appropriate accessor and mutator methods. Also, design a program that creates three instances of the class. One instance should hold your information, and the other two should hold your friends' or family members' information.

Purchase this Solution

Solution Summary

This tutorial provides guidelines on how to write a various number of pseudocodes.

Solution Preview

Please see the attachment for proper formatting.

Problem #1
Suppose myCar is the name of a class variable that references an object, and go is the name of a method. (The go method does not take any arguments.) Write a pseudocode statement that uses the myCar variable to call the method.
Solution:
Class Car
Public Module go()
// Do something
End Module
Declare Car myCar
Set myCar = new Car()
Call myCar.go()

Problem #2
In pseudocode, write the first line fo the definition for a Poodle class. The class should extend the Dog class.
Solution:
Class Poodle Extends Dog

Problem #3
Look at the following pseudocode class definitions:
Class Plant
Public Module message()
Display "I'm a plant."
End Module
Class Tree Extends Plant
Public Module message()
Display "I'm a tree."
End Module
End Class
Given these class definitions, what will the following pseudocode display?
Declare Plant p
Set p = new Tree()
Call p.message()
Solution:
I'm a tree.

Problem #4
Design a class named Pet, which should have ...

Purchase this Solution


Free BrainMass Quizzes
Basic UNIX commands

Use this quiz to check your knowledge of a few common UNIX commands. The quiz covers some of the most essential UNIX commands and their basic usage. If you can pass this quiz then you are clearly on your way to becoming an effective UNIX command line user.

Basic Networking Questions

This quiz consists of some basic networking questions.

Java loops

This quiz checks your knowledge of for and while loops in Java. For and while loops are essential building blocks for all Java programs. Having a solid understanding of these constructs is critical for success in programming Java.

C++ Operators

This quiz tests a student's knowledge about C++ operators.

Excel Introductory Quiz

This quiz tests your knowledge of basics of MS-Excel.