Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The Full Caesar Program We now have: The top-level pseudo code for the Caesar program: get inputs from the user, deal with the input, encrypt

The Full Caesar Program

We now have:

  • The top-level pseudo code for the Caesar program: get inputs from the user, deal with the input, encrypt the input, print out the encrypted version,
  • A function called convert_to_Caesar() which converts the user's input into something suitable to be encrypted, and
  • A function called encrypt_Caesar() which does the encryption work

Your task now is to crete a single Python program called caesar.py. It will contain the two functions from the previous tasks.(which takes as input the string of text that the user gave us on the command line) (which takes as input the shift value and the string of text that has been converted. It will read in the user's inputs from the command line and perform the top-level pseudo-code. As you have already been given this pseudo-code, there is no need for you to write it.

Step 1: Write Tests for the Program

This time, we are writing a full Python program (i.e. a software application) and not just a function. However, we can still test it, as the user will enter two input values on the command line, and your program will output a piece of encrypted text.

To prove that your Python program is correct, you will wrte a set of at least 5 test cases for your function. Each test case consists of four things:

  • the input shift value which the user would enter on the command line
  • the input string which the user would enter on the command line
  • what your program should print out
  • any comment about this test case

As this is a program and not a function, it can behave quite differently to a function. For example:

  • the program might decide to print an error message
  • the program might decide to exit and not print out a line of text

Do not use any of the 10 test cases that you previously wrote. Instead, think of new test cases that exhibit the behaviour of your program, not of the functions in your program.

Step 2: Convert the Pseudo-Code into Python

Take the top-level pseudo code and translate it into Python. Use the two functions that you previously wrote to perform some of the functionality. Remember to be a defensive programmer and check the inputs from the user for validity.

Document your Python code as follows:

  • At the top of your program, put in these comment lines:

# Author:

# Date:

  • After these lines, use comments to document the program's purpose and API. What does it do? What input(s) does it expect, and where do they comes from? What type of output will it produce? What sorts of input count as bad inputs? What will the function do with bad inputs? Will any error messages be printed out? Will the program exit on error inputs?
  • Put comments before each main section of your main program's Python code. Remember: a useful comment explains what you are doing and why, not how this is being done. A programmer can read the code and see how the code works, but they can't understand why you are doing it.

Run your program from the command-line, and use your tests to check your program for errors and identify any inputs that are not covered correctly by your code.

Performance Criteria

4.1 Check the script or code, for syntax and semantic errors

4.2 Identify any areas that are not covered, or are covered incorrectly, in the script or code

Step 3: User Documentation

All software should come with internal documentation for both the programmer (so that the software can be maintained) and external documentation for the user (so that the user knows how to use the program). Historically, the Unix operating system came with a set of manual pages; each program had its own manual page with these sections:

NAME: name and purpose of the program

SYNOPSIS: an abstract description of how to run it on the command line

DESCRIPTION: a description of the program's purpose, how to use it, what errors it deal with etc.

SEE ALSO: if needed, a list of related programs and commands

BUGS: if the program cannot deal with all possible user inputs, these are described here.

As as example, read this example of the cat command from the 7th Edition of Unix.

You will wrie a Word document which is a user manual for your caesar.py program which is

structured like the Unix manual pages.

Performance Criteria

5.2 Create user-level documentation

Step 4: Upload Your Work

For task 3, you are to upload these two files to Connect:

A Word document containing the user manual for your caesar.py program

A text or Word document containing your test cases for the program.

A working Python program called caesar.py which is fully documented.

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

Financial management theory and practice

Authors: Eugene F. Brigham and Michael C. Ehrhardt

12th Edition

978-0030243998, 30243998, 324422695, 978-0324422696

Students also viewed these Programming questions

Question

What are skimming and penetration pricing?

Answered: 1 week ago