Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

CIS22B Lab 1: Must contain 3 fucntions: main, sort, search Q1: Write a program that will - 1. Read in the contents of a text

CIS22B Lab 1:

Must contain 3 fucntions: main, sort, search

image text in transcribed

Q1: Write a program that will - 1. Read in the contents of a text file up to a maximum of 1024 words you create your own input. When reading the 2. Sort the words read in ascending order in an array (you are not allowed to use Vectors) using the Selection Sort 3. Search any item input by user in your sorted list using the Binary Search algorithm implemented in its own function. file contents, you can discard words that are single characters to avoid symbols, special characters etc. algorithm implemented in its own function. 4. Use string comparisons as taught in CIS 22A for comparing/ ordering words, i.e. words starting with numbers sort lower than words starting with uppercase letters which are lower than words starting with lowercase letters. So a word appearing once with one set of case is different than its second appearance with a different set of case, e.g. 'Do and 'do' are not the same 5. If a word appears twice using exactly the same case, it can be stored twice side-by-side in the array and either index can be returned in the search. 6. Your program will o first ask the user for a location+name from where to read the file and location+name where to save the output o read the contents into an array, ignoring single character words, o sort the contents of the array in alphabetically ascending order and o then start a loop to allow the user to search for one or more words in the array your loop should have an appropriate exit condition. If the word is found, the program should output which array location the word was found in, if not found then it should output an appropriate message o Provide clear prompts as necessary for good user interactivity 7. Your output should be sent to both screen and an output file concurrently. Screen output should contain the entire user interaction. The file output should contain all the user interaction that went to the screen as well as the listing of the sorted array cin/cout should only be in those 3 functions. Compress all of these into a single ZIP file format to upload 8. User interactivity should be limited to your main, input and/or output functions only what that means is your 9. Your output will consist of at least 4 files your CPP file, your text input, the screen output and file outputs 10. I will test your program with my own input file This assignment is worth 20 points 1.4 points for sort and search functions combined 2. 6 points for the main program code and input/output, including clarity of user interaction. 3. 4 points for code documentation not including pseudocode 4. 4 points for the pseudo-code and its resemblance to the actual code 5. 2 points for following all submission related instructions carefully Q1: Write a program that will - 1. Read in the contents of a text file up to a maximum of 1024 words you create your own input. When reading the 2. Sort the words read in ascending order in an array (you are not allowed to use Vectors) using the Selection Sort 3. Search any item input by user in your sorted list using the Binary Search algorithm implemented in its own function. file contents, you can discard words that are single characters to avoid symbols, special characters etc. algorithm implemented in its own function. 4. Use string comparisons as taught in CIS 22A for comparing/ ordering words, i.e. words starting with numbers sort lower than words starting with uppercase letters which are lower than words starting with lowercase letters. So a word appearing once with one set of case is different than its second appearance with a different set of case, e.g. 'Do and 'do' are not the same 5. If a word appears twice using exactly the same case, it can be stored twice side-by-side in the array and either index can be returned in the search. 6. Your program will o first ask the user for a location+name from where to read the file and location+name where to save the output o read the contents into an array, ignoring single character words, o sort the contents of the array in alphabetically ascending order and o then start a loop to allow the user to search for one or more words in the array your loop should have an appropriate exit condition. If the word is found, the program should output which array location the word was found in, if not found then it should output an appropriate message o Provide clear prompts as necessary for good user interactivity 7. Your output should be sent to both screen and an output file concurrently. Screen output should contain the entire user interaction. The file output should contain all the user interaction that went to the screen as well as the listing of the sorted array cin/cout should only be in those 3 functions. Compress all of these into a single ZIP file format to upload 8. User interactivity should be limited to your main, input and/or output functions only what that means is your 9. Your output will consist of at least 4 files your CPP file, your text input, the screen output and file outputs 10. I will test your program with my own input file This assignment is worth 20 points 1.4 points for sort and search functions combined 2. 6 points for the main program code and input/output, including clarity of user interaction. 3. 4 points for code documentation not including pseudocode 4. 4 points for the pseudo-code and its resemblance to the actual code 5. 2 points for following all submission related instructions carefully

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Transact SQL Cookbook Help For Database Programmers

Authors: Ales Spetic, Jonathan Gennick

1st Edition

1565927567, 978-1565927568

More Books

Students also viewed these Databases questions

Question

Jones needed to do something to revitalize the association.

Answered: 1 week ago

Question

the inital cost of one customized machine is 6 7 5 0 0 0

Answered: 1 week ago

Question

1. How will you, as city manager, handle these requests?

Answered: 1 week ago