Starting Out with C++: Early Objects
8th Edition
ISBN: 9780133360929
Author: Tony Gaddis, Judy Walters, Godfrey Muganda
Publisher: Addison-Wesley
expand_more
expand_more
format_list_bulleted
Question
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.
- Check whether the name is equal to vector name. If yes,
- Exit the function
- Loop executes until the k is less than size of vector. If yes,
- 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.
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
Problem:
• Assume that we have a matrix
that stored inside a file and it
contains monthly salary of each
employee of a company. The
matrix column starts from
month 1 to 12, and for the rows
you can enter data for 6
employees minimum.
• The output of the program must
be the annual salary of each
employee of the company.
#The Iris Dataset
import sklearn.datasetsimport matplotlib.pyplot as plt import numpy as np import scipy
iris = sklearn.datasets.load_iris()
Write a function that takes in an index i and prints out a verbose desciption of the species and measurements for data point i. For example:Data point 5 is of the species setosaIts sepal length (cm) is 5.4Its sepal width (cm) is 3.9Its petal length (cm) is 1.7Its petal width (cm) is 0.4
Computer Science
(PYTHON) Once a transaction completes, update the quantity on hand for each item sold to a customer in the dictionary:
Quantity = {101:2,102:5,103:8,104:2,105:8,106:4,107:6,108:3,109:2,110:10}
Chapter 16 Solutions
Starting Out with C++: Early Objects
Ch. 16.1 - Prob. 16.1CPCh. 16.1 - Prob. 16.2CPCh. 16.1 - Prob. 16.3CPCh. 16.1 - Prob. 16.4CPCh. 16.1 - Prob. 16.5CPCh. 16.2 - Prob. 16.6CPCh. 16.2 - The function int minPosition(int arr[ ], int size)...Ch. 16.2 - What must you be sure of when passing a class...Ch. 16.2 - Prob. 16.9CPCh. 16.4 - Prob. 16.10CP
Ch. 16.4 - In the following Rectangle class declaration, the...Ch. 16 - The line containing a throw statement is known as...Ch. 16 - Prob. 2RQECh. 16 - Prob. 3RQECh. 16 - Prob. 4RQECh. 16 - The beginning of a template is marked by a(n)...Ch. 16 - Prob. 6RQECh. 16 - A(n)______ container organizes data in a...Ch. 16 - Prob. 8RQECh. 16 - Prob. 9RQECh. 16 - Prob. 10RQECh. 16 - Write a function template that takes a generic...Ch. 16 - Write a function template that is capable of...Ch. 16 - Describe what will happen if you call the function...Ch. 16 - Prob. 14RQECh. 16 - Each of the following declarations or code...Ch. 16 - Prob. 16RQECh. 16 - String Bound Exceptions Write a class BCheckString...Ch. 16 - Prob. 2PCCh. 16 - Prob. 3PCCh. 16 - Sequence Accumulation Write n function T...Ch. 16 - Rotate Left The two sets of output below show the...Ch. 16 - Template Reversal Write a template function that...Ch. 16 - SimpleVector Modification Modify the SimpleVector...Ch. 16 - Prob. 8PCCh. 16 - Sortabl eVector Class Template Write a class...Ch. 16 - Prob. 10PCCh. 16 - Word Transformers Modification Modify Program...
Knowledge Booster
Similar questions
- IN C PROGRAMMING LANGUAGE AND COMMENT EVERY LINE SO I COULD UNDERSTAND EVERY STEP PLEASE, Write a program that implements the binary search for a set of integers stored in a data file. (Note that the data set in sorted in an ascending order).arrow_forwardsolution in python languagearrow_forwardWrite a prgram that creates a dictionary containing course numbers and room numbers of the room where the courses meet. The dictionary should have the following key value pairs: Course Number Room Number CS101 3004 CS102 4501 CS103 6755 NT110 1244 CM241 1411 This program should also create a dictionary containing course numbers and the names of the instructors that teach each course. The dictionary should have the following key-value pairs: Course Number Instructor CS101 Haynes CS102 Alvarado CS103 Rich NT110 Burke CM241 Lee This program should also create a dictionary containing the course numbers and the meeting times of each course. The dictionary should have the following key values Course number Meeting Time CS101 8:00 a.m. CS102 9:00 a.m. CS103 10:00 a.m. NT110 11:00 a.m. CM241 1:00 p.m. If…arrow_forward
- Design a function: int search (float a[ ], int n, float x); The function searches in array a of size n for the item x. If x is found , its index is returned, otherwise -1 is returned. Design the main function also.arrow_forwardSome rows of the STUGRADE table of a school are shown below: STU_CODE CLS_CODE GRADE YEAR 291 111 3.1 2010 938 101B 2.3 2011 931 M101 3.3 2040 291 M101 3.4 2018 190 111 2.0 2021 931 321 3.9 2003 Suppose that STU_CODE is the student code (foreign key) and CLS_CODE is the class code (foreign key). Which of the following computes the average for each year of the student with code 931? a. SELECT AVG(GRADE) FROM STUGRADE WHERE STU_CODE = 931 GROUP BY YEAR b. SELECT AVG(GRADE) FROM STUGRADE WHERE STU_CODE = 931. c. SELECT AVG(GRADE) FROM STUGRADE GROUP BY STU_CODE = 931 d. SELECT AVG(GRADE) FROM STUGRADE WHERE STU_CODE = 931 GROUP BY AVG(GRADE)arrow_forwardThere are many parts to this question and I'm in dire need of assistance. please help in pythonarrow_forward
- By pythonarrow_forwardGiven this array containing characters: Data В C F H J L M R S V X Z Index 1 3 4 5 7 8 9 10 11 12 13 List out the low, middle, and high indices for each pass when using binary search to locate the value 'Q' in the list. Use the following format for each pass needed: Pass: Low: Mid: High:arrow_forwardTake a file as input that has the names, ids, and departments of sample input . 1. Make a dictionary for each student containing the id as key, name, and department as values. 2. The output should be a file where the key will be the name of the file and it will name two lines in it. sample input : Robyn Ford, 3946, EngineeringDwight Parks, 3147, ScienceMarguerite Roy, 3372, EngineeringMax Larson, 8377, MathIgnacio Cohen, 3280, MathShelley Saunders, 3917, ScienceJodi Ballard, 2782, ScienceSylvia Tucker, 2046, MathBecky Gonzalez, 3021, Business sample of output for each student : 1st line- Name: Jane Doe 2nd line- Department: DC Comics. 3rd line- student Idarrow_forward
- True/False 9. A Python dictionary is a kind of sequence.arrow_forwardAssume that grade records are dictionaries that always contain three keys: "Assi gnments", "Midterm“, and "Final". An example of such a record might be: {"Assignments" :[99, 98, 100, 100, 80], "Midterm" :95, "Final" : 90} Note that the "Assignments" key is associated with a list, rather than a single integer; this is because there were 5 assignment grades in the class. All numeric values will be in the range 0 to 100 (i.e. they are percent ages). Also assume that dictionary_students is a dictionary in which the keys are student names and the values are grade records. Define a function called final_grades () that accepts dictionary_students as its only parameter. The function should add a new key-value pair to each grade record in dictionary_students. The key for this pair should always the be word "Grade", and the value should be the student's final overall grade in the class. The final grade can be calculated according to the following information from the course syllabus: • Each…arrow_forwardPython Write a function print_dict to print all the key-values in a dictionary, for example: >>> d2 {'a': 'one', 'b': 'two', 'c': 'Three'} >>> print_dict(d2) a:one b:two c:Threearrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Programming Logic & Design ComprehensiveComputer ScienceISBN:9781337669405Author:FARRELLPublisher:CengageC++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology PtrSystems ArchitectureComputer ScienceISBN:9781305080195Author:Stephen D. BurdPublisher:Cengage Learning
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
Systems Architecture
Computer Science
ISBN:9781305080195
Author:Stephen D. Burd
Publisher:Cengage Learning