CUCNY Computational Thinking for the Modern Problem Solver Discussion

User Generated

gbz23

Programming

Columbia University in the City of New York

Description

Please see attachments

String Sorter Part 2

Last week, you were asked to help write a program to sort medication lists. This week, we’re going to build on that.

In part 2 of this assignment, you will be presented with 2 more complete programs: StringSorterV3.py and StringSorterV4.py. They both perform the same task, sorting a list of medications; however each approach is slightly different. Each of these performs the task specified in Section 1.1 and developed in Chapter 1 of the Essentials of Software Engineering text, and are further illustrated in the Python for Chapter 1 document.

Testing the Programs

You are to first test the operation of each of these modules with the provided lists of medications to familiarize yourself with them, and to convince yourself that they work. If you discover that one or more of these implementations does not work correctly then you are to prepare a document in which you illustrate (through screen shots) and explain representative cases that fail.

Modifying the Programs

Next, you are to modify each of these implementations (V3 and V4) so that blank lines in the input are ignored in the result.

Please do not change the name of the methods, but do rename your modified files by appending an ‘R’ to each filename; thus StringSorterV3.py becomes StringSorterV3R.py, etc. Along with submitting these two Python source code files, you are to prepare and submit a single document in which you illustrate (through screenshots) the execution of your revised implementations, with accompanying narrative explanations as appropriate.

Additional and Optional:

Improving the operation of the StringSorter implementations may be accomplished by developing a Python function to compare two strings rather than relying directly upon Python’s intrinsic operators to compare strings.

Such a function could then implement its own algorithm to compare two strings interpreting lower and uppercase in a more natural way. Consider the following table that presents the strings from medications1.txt in their original order and also in the order obtained by having Microsoft Word sort them. This result is considered to be such a more natural ordering and you are to develop your algorithm to accomplish this ordering.

Such a function would return true if and only if a given second string is considered to be “greater than” (i.e. appears alphabetically after) a given first string according to this algorithm.

For this additional and optional part of this assignment you are to develop this function and then refactor each of the four StringSorter implementations in the corresponding Python source code files to use this function.

Again, please do not change the name of the other methods, but do rename your modified files by appending a ‘AO’ to each filename; thus StringSorterV3R.py becomes StringSorterV3RAO.py, etc. Along with submitting these two Python source code files, you are to prepare and submit a document in which you illustrate (through screenshots) the execution of these refactored implementations, with accompanying narrative explanations as appropriate.

Submission

You are to submit 3 files:

  1. If applicable, a Word Document with screenshots of cases where the program failed in your initial tests.
  2. The Source Code, StringSorterV3R.py and StringSorterV3R.py
  3. A Word Document with screenshots of the working revisions and explanation of those revisions.

If you run into any issues, please describe them, what you tried to do to fix them, and why they didn’t work.

Unformatted Attachment Preview

Assignment: Chapter 9 Questions Introduction Prepare written answers to, and be prepared to discuss each of the following questions, each of which is taken from, is an extension of, or is inspired by the correspondingly numbered exercise question from the Computational Thinking for the Modern Problem Solver text. Chapter 9: Exercise Question 2. If you are the customer for a software application, which of the following kinds of testing would you be least likely to perform? 1. 2. 3. 4. Acceptance testing Beta testing Black box testing White box testing Exercise Question 4. Suppose a vending machine company designs a new machine that will dispense anything that is stored in a plastic bag, similar to a bag of potato chips. The ideal size for a bag dispensed by this machine is 11 cm by 18 cm, but the machine is designed to accept bags that are 1 cm longer or shorter in either dimension. Design a test suite for this machine using the concept of boundary value analysis. Exercise Question 5. Imagine that you are designed a knockoff of the popular Angry Birds game. A simple version of your game will have three different kinds of birds (round, triangular, and square) along with two kinds of materials for building structures around the pigs (wooden or steel). Each kind of bird behaves differently when striking material. Each material produces different results when struck by a bird, except for round birds, which behave the same for both wood and steel. Describe the different equivalence classes of this system in terms of bird and material type. You should select each group in such a way to ensure that it has a behavior that is different from all others. Assignment: Chapters 10, 11 & 12 Questions Prepare written answers to, and be prepared to discuss each of the following questions, each of which is taken from, is an extension of, or is inspired by the correspondingly numbered question from the Essentials of Software Engineering text. Chapter 10: Review Question 1. Consider the diagram shown in Figure 10.8. 1. How many logical paths are there? List them all. 2. How many paths are required to cover all the statements? 3. How many paths are required to cover all the branches? Review Question 9. What is the difference between performance testing and stress testing? Provide examples. Exercise Question 3. Describe your level of comfort for quality if a group of software developers tell you that they utilized test-driven development. Explain. ______________________________________________________________________ _____________________________________________ Chapter 11: Review Question 6. What is linking and what are we linking in a build process? Exercise Question 6. In version control, there has been debate on how to implement the internal storage of the different versions of an artifact. One argument is to keep the complete copy of each version. Another is to keep only the delta changes from version to version, with the first version being the only complete copy. 1. Give one reason why you may want to keep a complete copy of each version. 2. Give one reason why you may want to keep only the delta changes. 3. What would be the advantages and drawbacks of each of these approaches? ______________________________________________________________________ ___________________________________________ Chapter 12: Review Question 1. List three customer support functions that a customer support/service organization performs. Exercise Question 1. Visit the online customer support site of a software product company that you routinely use at work and compare the list of support functions they offer against your list from Review Question 1. Testing Number Guessing Game Introduction Introduction Recall the Number Guessing Game assignments from Weeks 4-5, which involved the integration of Python modules to develop an application that allows users to take a set number of turns, trying to guess the correct number. For this assignment, you are to develop a plan to test this application. You are expected to draw upon your understanding of the concepts and ideas presented in the readings to develop a specific enough plan that could be communicated to others and carried out by them. In part, this will involve the formulation of a test suite. On the one hand testing is done as part of verification in an attempt to demonstrate quality, and on the other hand testing is done to uncover errors and other such defects in software so they can be fixed. Comment on the expected effectiveness of the plan you have developed as pertains to these two expectations. It would be best (if needed) to review only the requirements as listed in Weeks 4-5, and not the specific code you wrote as to not bias yourself to a testing plan. 1. Add the assignment below (files attached separately): String Sorter Part 2 Introduction Last week, you were asked to help write a program to sort medication lists. This week, we’re going to build on that. In part 2 of this assignment, you will be presented with 2 more complete programs: StringSorterV3.py and StringSorterV4.py. They both perform the same task, sorting a list of medications; however each approach is slightly different. Each of these performs the task specified in Section 1.1 and developed in Chapter 1 of the Essentials of Software Engineering text, and are further illustrated in the Python for Chapter 1 document. Testing the Programs You are to first test the operation of each of these modules with the provided lists of medications to familiarize yourself with them, and to convince yourself that they work. If you discover that one or more of these implementations does not work correctly then you are to prepare a document in which you illustrate (through screen shots) and explain representative cases that fail. Modifying the Programs Next, you are to modify each of these implementations (V3 and V4) so that blank lines in the input are ignored in the result. Please do not change the name of the methods, but do rename your modified files by appending an ‘R’ to each filename; thus StringSorterV3.py becomes StringSorterV3R.py, etc. Along with submitting these two Python source code files, you are to prepare and submit a single document in which you illustrate (through screenshots) the execution of your revised implementations, with accompanying narrative explanations as appropriate. Additional and Optional: Improving the operation of the StringSorter implementations may be accomplished by developing a Python function to compare two strings rather than relying directly upon Python’s intrinsic operators to compare strings. Such a function could then implement its own algorithm to compare two strings interpreting lower and uppercase in a more natural way. Consider the following table that presents the strings from medications1.txt in their original order and also in the order obtained by having Microsoft Word sort them. This result is considered to be such a more natural ordering and you are to develop your algorithm to accomplish this ordering. Such a function would return true if and only if a given second string is considered to be “greater than” (i.e. appears alphabetically after) a given first string according to this algorithm. For this additional and optional part of this assignment you are to develop this function and then refactor each of the four StringSorter implementations in the corresponding Python source code files to use this function. Again, please do not change the name of the other methods, but do rename your modified files by appending a ‘AO’ to each filename; thus StringSorterV3R.py becomes StringSorterV3RAO.py, etc. Along with submitting these two Python source code files, you are to prepare and submit a document in which you illustrate (through screenshots) the execution of these refactored implementations, with accompanying narrative explanations as appropriate. Submission You are to submit 3 files: 1. If applicable, a Word Document with screenshots of cases where the program failed in your initial tests. 2. The Source Code, StringSorterV3R.py and StringSorterV3R.py 3. A Word Document with screenshots of the working revisions and explanation of those revisions. If you run into any issues, please describe them, what you tried to do to fix them, and why they didn’t work. String Sorter Part 2 Last week, you were asked to help write a program to sort medication lists. This week, we’re going to build on that. In part 2 of this assignment, you will be presented with 2 more complete programs: StringSorterV3.py and StringSorterV4.py. They both perform the same task, sorting a list of medications; however each approach is slightly different. Each of these performs the task specified in Section 1.1 and developed in Chapter 1 of the Essentials of Software Engineering text, and are further illustrated in the Python for Chapter 1 document. Testing the Programs You are to first test the operation of each of these modules with the provided lists of medications to familiarize yourself with them, and to convince yourself that they work. If you discover that one or more of these implementations does not work correctly then you are to prepare a document in which you illustrate (through screen shots) and explain representative cases that fail. Modifying the Programs Next, you are to modify each of these implementations (V3 and V4) so that blank lines in the input are ignored in the result. Please do not change the name of the methods, but do rename your modified files by appending an ‘R’ to each filename; thus StringSorterV3.py becomes StringSorterV3R.py, etc. Along with submitting these two Python source code files, you are to prepare and submit a single document in which you illustrate (through screenshots) the execution of your revised implementations, with accompanying narrative explanations as appropriate. Additional and Optional: Improving the operation of the StringSorter implementations may be accomplished by developing a Python function to compare two strings rather than relying directly upon Python’s intrinsic operators to compare strings. Such a function could then implement its own algorithm to compare two strings interpreting lower and uppercase in a more natural way. Consider the following table that presents the strings from medications1.txt in their original order and also in the order obtained by having Microsoft Word sort them. This result is considered to be such a more natural ordering and you are to develop your algorithm to accomplish this ordering. Such a function would return true if and only if a given second string is considered to be “greater than” (i.e. appears alphabetically after) a given first string according to this algorithm. For this additional and optional part of this assignment you are to develop this function and then refactor each of the four StringSorter implementations in the corresponding Python source code files to use this function. Again, please do not change the name of the other methods, but do rename your modified files by appending a ‘AO’ to each filename; thus StringSorterV3R.py becomes StringSorterV3RAO.py, etc. Along with submitting these two Python source code files, you are to prepare and submit a document in which you illustrate (through screenshots) the execution of these refactored implementations, with accompanying narrative explanations as appropriate. Submission You are to submit 3 files: 1. If applicable, a Word Document with screenshots of cases where the program failed in your initial tests. 2. The Source Code, StringSorterV3R.py and StringSorterV3R.py 3. A Word Document with screenshots of the working revisions and explanation of those revisions. If you run into any issues, please describe them, what you tried to do to fix them, and why they didn’t work.
Purchase answer to see full attachment
User generated content is uploaded by users for the purposes of learning and should be used following Studypool's honor code & terms of service.

Explanation & Answer

StringSorter QuestionThe StringSorter question has three files. The codes to be copied to Thonny and run are in the StringsorterV3_V3 codes word document . The other two are meant to be submitted as word documents along.(See assignment requirements)RegardsTutor_Khloe25

# StringSorterV3.py
# ----------------def getStrings():
result = []
inputFile = open("medications.txt","r")
for line in inputFile:
result.append(line)
inputFile.close()
return result

def putStrings(strings):
outputFile = open("medicationsV3.txt","w")
for string in strings:
outputFile.write(string.lstrip("\n"))
outputFile.close()

def StringSorter():
lines = getStrings()
lines.sort()
#

print(lines)
putStrings(lines)
print(lines)

StringSorter()

# StringSorterV4.py

# ----------------lines =list()
def getStrin...

Related Tags