. 03:Assignment 3 G While we are still focused on coll x O C...
Question
Answered step-by-step
Asked by BarristerDragonMaster652 on coursehero.com
. 03:Assignment 3 G While we are still focused on coll x O C...
Image transcription text
03:Assignment 3
G
While we are still focused on coll x
O
C
canvas.tccd.edu/courses/73630/assignments/1269347
TCC county
2023 Spring
SUCCESS WITHIN REACH.
Class,
Home
While we are still focused on collections such as Arrays and Vectors, it is important to also consider how data is loaded into
Syllabus
these structures. I will admit that other languages can make this task much easier. Let's work with some real world examples.
Account
Announcements
The Files referred to below are in the item named "This week's Assignment Resources" in this module.
Modules
I have included an industry standard file called airports.dat. It lists the major commercial airports in the world in a comma
Dashboard
Grades
11
delimited format. Your assignment is to read this data and populate a vector with the 3 character airport code that is in the 5th (
4th indexed) delimited position of the file. Review Chapter 5 - Reading Data from a File. If that airport code value happens to be
Courses
People
empty or does not have a length of 3 characters, do not include it in your vector. Also, if you cannot read or find the file, you
Office 365
should exit the program.
Calendar
BigBlueButton
Feel free to open the airports.dat file and see how it is structured.
Eb
Course Materials
Task 1: I have included a file called LoadAirports.cpp for this assignment. Modify this program to do the steps required for this
Inbox
assignment. Put your name in the heading comments and complete the //TODOs,
Qwickly Attendance
Read the attached file (AddingFileInVS.txt) on how I need you to open and plant the data file for your programs.
History
Task 2. Once you have this, sort the vector using built-in sort method. This method is not yet covered in your book. See
https://en.wikipedia.org/wiki/Sort_(C%2B%2B) _for an example. Basically the syntax is:
Studio
sort (yourVectorName.begin(), yourVectorName.end());
Task 3, Write a method that will validate that the vector is actually sorted. It should simply COUT that "Collection is sorted" or
lelp
"Collection is NOT sorted". Call this method before you sort the array and also after you sort the array.
Task 4, In main(), create a loop and prompt for values to search for.
Be aware that unlike Arrays which are always passed by reference to a method, Vectors are passed by value by default. You must
use the & indicator or return a vector to absorb changes to a vector made in a method.
The steps done or invoked from main() are below. You should display what step you are on as the program proceeds. Note that
K
steps 1 - 2b are provided for you in the LoadAirports.cpp program.
Sunny
Q Search
" () O
6:36 PM
2/3/2023
16...
Image transcription text
03:Assignment 3
G
While we are still focused on coll x
O
C
canvas.tccd.edu/courses/73630/assignments/1269347
TCC county
2023 Spring
SUCCESS WITHIN REACH.
Home
1. Open the File - Exit if error during open
2. Loop until end of file
Syllabus
Account
a. Read a line from the file.
Announcements
b. Pass the line to the split method
Modules
Dashboard
c. Obtain and validate specified data and place valid data into your new airportCode vector.
Grades
11
3. Display the number of elements in the vector that contains the airport codes.
Courses
People
4. Check and report if vector is sorted or not sorted
Office 365
5. Sort Vector
Calendar
BigBlueButton
6. Check and report if vector is sorted or not sorted.
Eb
Course Materials
Inbox
7. Create a loop in main() to prompt to find valid Airport codes. Expect only uppercase input. Display "Found" or "Not found". Use
Qwickly Attendance
"X" to exit your loop. Display "Done" when complete.
History
Enter an Airport Code: 0000
Not found
Enter an Airport Code : DFW
Found
Studio
Enter an Airport Code:X
Done !
The Deliverable is your CPP file.
lelp
5pts Extra Credit: Use the available find method for the vector search. See C++ find
Previous
Next >
K
6:36 PM
Sunny
Q Search
2/3/2023
16...
Answer & Explanation
Solved by verified expert
Answered by ChancellorQuetzalMaster762 on coursehero.com
<pre><code class="language-plaintext">sectetur adipiscing elit. Nam lacinia pulvinar tortor nec facilisis. Pellentesque dapibus efficitur laoreet. Nam risus ante, dapibus a molestie consequat, ultrices ac magna. Fusce dui lectus, congue vel laoreet ac, dictu</code></pre>sectetur adipiscing eli
Unlock access to this and over 10,000 step-by-step explanations
<p style="margin-left:0px;">sectetur adipiscing elit. Nam lacinia pulvinar tortor nec facilisis. Pellentesque dapibus efficitur laoreet. Nam risus ante, dapibus a molestie consequat, ultrices ac magna. Fusce dui lectus, congue vel laoreet ac, dictum vitae odio. Donec aliquet. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam l</p><p style="margin-left:0px;"> </p><p style="margin-left:0px;">sectetur adipiscing elit. Nam lacinia pulvinar tortor nec facilisis. Pellentesque dapibus efficitur laoreet. Nam risus ante, dapibus a molestie consequat, ultrices ac magna. Fusce dui lectus, congue vel laoreet ac, dictum vitae odio. Donec aliquet. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam lacinia pulvinar tortor nec facilisis. Pellentesque dapibus efficitur laoreet. Nam risus ante, dapibus a molestie consequat, ultrices ac magna. Fusc</p><p style="margin-left:0px;"> </p><p style="margin-left:0px;">sectetur adipiscing elit. Nam lacinia pulvinar tortor nec facilisis. Pellentesque dapibus efficitur laoreet. Nam risus ante, dapibus a molestie consequat, ultrices ac magna. Fusce dui lectus, congue vel laoreet ac, dictum vitae odio. Donec aliquet. Lorem ipsum dolor sit amet, consecte</p><p style="margin-left:0px;"> </p><p style="margin-left:0px;">sectetur adipiscing elit. Nam lacinia pulvinar tortor nec facilisis. Pellentesque dapibus efficitur laoreet. Nam risus ante, dapibus a molestie consequat, ultrices ac magna. Fusce dui lectus, congue vel laoreet ac, dictum vitae odio. Donec aliquet. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam</p><p style="margin-left:0px;"> </p><p style="margin-left:0px;">sectetur adipiscing elit. Nam lacinia pulvinar tortor nec facilisis. Pellentesque dapibus efficitur laoreet. Nam risus ante, dapibus a molestie consequat, ultrices ac magna. Fusce dui lectus, congue vel l</p><p style="margin-left:0px;"> </p><p style="margin-left:0px;">sectetur adipiscing elit. Nam lacinia pulvinar tortor nec facilisis. Pellentesque dapibus efficitur laoreet. Nam risus ante, dapibus a molestie consequat, ultrices ac magna. Fusce dui lectus, congue vel laoreet ac, dictum vitae odio. Donec aliquet. Lorem ipsu</p>
Get unstuck with a CliffsNotes subscription
Unlock every step-by-step explanation, download literature note PDFs, plus more.Get Access