Docsity

Text Scrambling Program: Preserve First and Last Letters - Prof. Joseph D. Sloan, Assignments of Computer Science

Toggle sidebar
bg1
Scramble Text Assignment
Consider the following:
Aoccdrnig to a rscheearch at Cmabrigde Uinervtisy, it deosn’t
mttaer in waht oredr the ltteers in a wrod are, the olny iprmoetnt
tihng is taht the frist and lsat ltteer be at the rghit pclae. The
rset can be a toatl mses and you can sitll raed it wouthit
porbelm. This is bcuseae the huamn mind deos not raed ervey
lteter by istlef, but the word as a wlohe.
(See http://www.mrc-cbu.cam.ac.uk/people/matt.davis/cmabridge/ for more information.)
This statement makes an interesting observation, but you might not be convinced by a
single example. Your task is to create a program that will take the text in a file and
generate a new example. You could use this to convince yourself of the validity of this
statement. And in doing so, you’ll also get a lot of practice using control structures and
working with text.
Your code should prompt the user for names for a source file and a destination file. It
should read the source file and scramble the text writing the results out to the destination
file. Scrambling should be consistent with the example above. In particular, the first and
last letters of a word should not be change, the case of the letters should not be altered,
and punctuation should be preserved. The scrambling within a word should be random.
Be sure to appropriately comment your code. Code must be organized making
appropriate use of subroutines. Please submit a structure chart for your code. This may
be hand drawn. Please submit your code electronically including your name as part of
the file name. Don’t forget to pledge your work and include with your code times
estimates for writing the code. You must work in pairs on this assignment or justify,
before the fact, why you cannot work as part of a team.
This project will count as three routine homework assignments.
Due: Wednesday, April 15

Partial preview of the text

Download Text Scrambling Program: Preserve First and Last Letters - Prof. Joseph D. Sloan and more Assignments Computer Science in PDF only on Docsity!

Scramble Text Assignment

Consider the following:

Aoccdrnig to a rscheearch at Cmabrigde Uinervtisy, it deosn’t

mttaer in waht oredr the ltteers in a wrod are, the olny iprmoetnt

tihng is taht the frist and lsat ltteer be at the rghit pclae. The

rset can be a toatl mses and you can sitll raed it wouthit

porbelm. This is bcuseae the huamn mind deos not raed ervey

lteter by istlef, but the word as a wlohe.

(See http://www.mrc-cbu.cam.ac.uk/people/matt.davis/cmabridge/ for more information.) This statement makes an interesting observation, but you might not be convinced by a single example. Your task is to create a program that will take the text in a file and generate a new example. You could use this to convince yourself of the validity of this statement. And in doing so, you’ll also get a lot of practice using control structures and working with text. Your code should prompt the user for names for a source file and a destination file. It should read the source file and scramble the text writing the results out to the destination file. Scrambling should be consistent with the example above. In particular, the first and last letters of a word should not be change, the case of the letters should not be altered, and punctuation should be preserved. The scrambling within a word should be random. Be sure to appropriately comment your code. Code must be organized making appropriate use of subroutines. Please submit a structure chart for your code. This may be hand drawn. Please submit your code electronically including your name as part of the file name. Don’t forget to pledge your work and include with your code times estimates for writing the code. You must work in pairs on this assignment or justify, before the fact, why you cannot work as part of a team. This project will count as three routine homework assignments. Due: Wednesday, April 1 5