Starting Out With C++: Early Objects, Student Value Edition (9th Edition)
Starting Out With C++: Early Objects, Student Value Edition (9th Edition)
9th Edition
ISBN: 9780134379319
Author: Tony Gaddis, Judy Walters, Godfrey Muganda
Publisher: PEARSON
Question
Book Icon
Chapter 16, Problem 10PC
Program Plan Intro

Two Dimensional Data

Program Plan:

  • Include the required header files.
  • Define the function getData(),
    • Declare and initialize the variable.
    • Loop executes until k is less than number. If yes,
      • Read the index of the tourists from file.
      • Store the tourists name into vector.
    • Loop executes until k is less than number. If yes,
      • Read the index of the tourists from file.
      • Loop executes until j is less than numberDestinations. If yes,
        • Read the destination from the file.
        • Add the favorite destination for each person.
      • Store the favorite destination for each person into another vector.
  • Define the function indexOf(),
    • Loop executes until the k is less than size of vector. If yes,
      • Check whether the name is equal to vector name. If yes,
        • Return the k value.
    • Exit the function
  • Define the “main()” function.
    • Create object to open the file.
    • Check for file existence. If yes,
      • Display the file status.
    • Declare the two vectors.
    • Call getData() function retrieves data from the file and stores it into two vectors.
    • Loop executes until k is size of tourists. If yes,
      • Display the names of tourists
    • Display the statement.
    • Loop executes until true. If yes,
      • Read the name of the tourist from user.
    • Check name is equal to quit. If yes, exit the program.
    • Call the indexOf() function returns the index of a string in a vector of strings.
    • Check the index is equal to -1. If yes,
      • Display the statement.
      • Continue the program.
    • Loop executes until the end of the vector. If yes,
      • Display the statement.
      • Increment iteration by 1.

Blurred answer
Students have asked these similar questions
Suppose that a shopkeeper decided that customers who come first will be served first. A list of customers must be maintained so that anyone can be accessed randomly. Your program must remember operations performed in the opposite order. The entries should be managed based on the order of arrival and also be deleted when no longer needed. The size of a file is unknown. A list must be maintained so that elements can be added to the beginning or end in O (1).Based on the above scenario you have a list of different data structures, choose appropriate among them and implement using java. It is important that the structure has flexible memory management.
Write a program that reads movie data from a csv (comma separated values) file and output the data in a formatted table. The program first reads the name of the CSV file from the user. The program then reads the csv file and outputs the contents according to the following requirements: Each row contains the title, rating, and all showtimes of a unique movie. A space is placed before and after each vertical separator (|) in each row. Column 1 displays the movie titles and is left justified with a minimum of 44 characters. If the movie title has more than 44 characters, output the first 44 characters only. Column 2 displays the movie ratings and is right justified with a minimum of 5 characters. Column 3 displays all the showtimes of the same movie, separated by a space. Each row of the csv file contains the showtime, title, and rating of a movie. Assume data of the same movie are grouped in consecutive rows. Ex: If the input of the program is: movies.csv and the contents of movies.csv…
Write a program that reads movie data from a CSV (comma separated values) file and output the data in a formatted table. The program first reads the name of the CSV file from the user. The program then reads the CSV file and outputs the contents according to the following requirements: Each row contains the title, rating, and all showtimes of a unique movie. A space is placed before and after each vertical separator ('|') in each row. Column 1 displays the movie titles and is left justified with a minimum of 44 characters. If the movie title has more than 44 characters, output the first 44 characters only. Column 2 displays the movie ratings and is right justified with a minimum of 5 characters. Column 3 displays all the showtimes of the same movie, separated by a space. Each row of the CSV file contains the showtime, title, and rating of a movie. Assume data of the same movie are grouped in consecutive rows. Hints: Use the find() function to find the index of a comma in each row of…

Chapter 16 Solutions

Starting Out With C++: Early Objects, Student Value Edition (9th Edition)

Knowledge Booster
Background pattern image
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage