Problem Solving with C++ (10th Edition)
Problem Solving with C++ (10th Edition)
10th Edition
ISBN: 9780134448282
Author: Walter Savitch, Kenrick Mock
Publisher: PEARSON
Question
Book Icon
Chapter 13, Problem 9PP
Program Plan Intro

Creation of program to construct classes to implement maze

Program Plan:

  • Define a class “Room” to define properties and methods.
    • Define constructors to create new instance.
    • Define a method “get_name()” to get name.
    • Define a method “get_adjacent_room()” to get adjacent room.
    • Define a method “link_room()” to assign value based on direction.
    • Define a method “get_available_directions()” to get available directions.
  • Define a main method.
    • Create new room instance using class.
    • Define connections in maze using “link_room()”.
    • Call method “get_available_directions()” to get available directions.

Blurred answer
Students have asked these similar questions
The purpose of this project is to assess your ability to (JAVA): Implement a graph abstract data type. The getDistance method should print the distance of all connected nodes/ vertices.   A graph is a set of vertices and a set of edges. Represent the vertices in your graph with an array of strings:   Represent the edges in your graph as a two-dimensional array of integers. Use the distances shown in the graph pictured here.Add the following functions to your graph class: A getDistance function that takes two vertices and returns the length of the edge between them. If the vertices are not connected, the function should return the max value for an integer. A getNeighbors function that takes a single vertex and returns a list of all the vertices connected to that vertex. A print method that outputs an adjacency matrix for your graph. Write a test program for your Graph class.
In C++, write a program that outputs the nodes of a graph in a breadth first traversal. Data File: Please use this data file. Text to copy:  100 1 3 -9991 4 -9992 5 -9993 2 -9994 -9995 7 8 -9996 4 7 -9997 -9998 -9999 7 8 -999 Diagram: Also, please take a look at the attached figure on and calculate the weights for the following edges: 0 -> 1 -> 4 0 -> 3 -> 2 -> 5 -> 7 0 -> 3 -> 2 -> 5 -> 8 6 -> 4 6 -> 7 9 -> 7 9 -> 8 To calculates these weights, please assume the following data: 0 -> 1 = 1 0 -> 3 = 2 1 -> 4 = 3 3 -> 2 = 4 2 -> 5 = 5 5 -> 7 = 6 5 -> 8 = 7 6 -> 4 = 8 6 -> 7 = 9 9 -> 7 = 10 9 -> 8 = 11
Create the following graph. Implement the following functions. 1. addEdge() that takes two vertices as two parameters and creates an Edge between them. 2. nonAdjacentVertices() that takes a single vertex as parameter, and returns an array of vertices that are NOT adjacent to that vertex. 3. Write a function addUnknownVertices() that takes a vertex as a parameters, and creates an Edge with the vertices that are NOT adjacent to it. 4. Write a method searchVertex() which takes an array of Vertices as parameters. The first member of the array will be the starting vertex and the last member will be the Vertex you want to reach. For example searchVertex(Vertex 0, Vertex 4, Vertex 3) will output “Vertex cannot be reached” since you can reach from 0 to 4, but cannot from 4 to 3. Again, searchVertex(Vertex 0, Vertex 1, Vertex 2, Node 3) will output “Vertex can be reached” since you can reach from 0 to 1, 1 to 2, 2 to 3.
Knowledge Booster
Background pattern image
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning