Design the algorithm for function in pseudo-code

Assignment Help Computer Engineering
Reference no: EM133337882

Case: As a defensive programmer, we have to assume that the user will give us an input message on the command line which has characters which are not uppercase. But the Caesar algorithm can only encrypt uppercase letters. We need to deal with this.

(We need a function which takes as input the string of text that the user gave us on the command line. It will return a new string of text which is suitable for encryption by the Caesar cipher, i.e. it must be all uppercase letters.

Here is the (partial) API for this function. It will be called convert_to_Caesar(). It will take one argument: a string of text. It will return: a string of text. The letters in the argument will be processed as follows:

  • uppercase letters will be left untouched
  • lowercase letters will be converted to uppercase letters: 'a' →'A', 'b' → 'B' etc.
  • the full stop '.' will be translated to the letter 'X' (as 'X' is rare, we can use it to separate sentences)
  • all other letters in the argument will be discarded

You will design the algorithm for this function in pseudo-code, i.e. semi-English. The algorithm must have these properties:

  • it must be guaranteed to stop and return a string regardless of the argument it is given
  • it must obey the API contract defined above regardless of the argument it is given
  • it must not crash or do unexpected things regardless of the argument it is given
  • the algorithm must be written in simple enough steps that it can be translated into a computer language like Python
  • the algorithm must be exact and well-defined, i.e. not open to interpretation

You will use English words like "if", "while" and "for" where they are suitable. These make sense to an English reader, but they also indicate programming structures such as sequence, selection and iteration to a programmer.)

Your task now is to create a single Python program called caesar.py. It will contain the two functions from the previous tasks. 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.

  1. 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( by using import sys and argv), and your program will output a piece of encrypted text.

Reference no: EM133337882

Questions Cloud

Implement security for applications : IT 501 Wells International College Implement security for applications by creating a simple e-Commerce and Learning Management System
What type of system development process technique : The luxury of taking a long time to consider all their options what type of system development process technique would you suggest?
Write a find command that finds all files : COMPUTER I CIS3512 Penn Foster College Write a sed command that will display all lines of the months file that do not contain the string March. What was
Implications for enchancing a depression website : State key policy (e.g., reimbursement), legal (e.g., FDA approval), standards that have (adherence required) implications for ENCHANCING A DEPRESSION WEBSITE?
Design the algorithm for function in pseudo-code : Create a single Python program called caesar - design the algorithm for this function in pseudo-code
Prepare the country to address cyber attacks : INFOST 491 University of Wisconsin, Based on your reflections about cyber security, expound on what would be your top five ways to best prepare the country
What is process of finding a network vulnerability : What is the step by step process of finding a network vulnerability? I have to find 3 network vulnerabilities using Kali Linux and Metasploitable 2.
Identify ethical issues related to managerial decision : Identify ethical issues related to managerial decision making. Search the Internet, join discussion groups/blogs, and read articles from the Internet
Which three of the five criteria do you find to be the most : Which three of the five criteria do you find to be the most important? Do they seem like enough to evaluate a website? How would you define each criterion

Reviews

Write a Review

Computer Engineering Questions & Answers

  Program that help an elementary school learn multiplication

Computers are playing an increasing role in education. Write a program that will help an elementary school learn multiplication. make Use of a Random object to produce two positive one-digit integers.

  Explain the difference between itsm and itil

Explain the difference between ITSM and ITIL. (Hint: http://www.bmc.com/blogs/itsm-or-itil-that-isnt-the-question/) List at least 2 other "ITSM" frameworks and briefly describe each one.

  Characterize a social network on twitter

Calculate graph metrics, Use those graph metrics to create different visualizations (with or without autofill), Look at the different clusters

  Write a program that prompts the user for the prices

Write a program that prompts the user for the prices of 10 automobiles (use looping to do this and store the prices in an array).

  Identify what each of them is used for

Choose two of the software on this list and identify what each of them is used for. Find an example of a SME or large enterprise that uses this software

  Develop a workforce with the skills to handle iot security

Security practitioners suggest that key IoT security steps include: Develop a workforce with the skills to handle IoT security. Address each of the FOUR IoT.

  Why are devices connecting to an application database

Quality of Service (QoS) is significant because it allows the user to prioritize tasks completed over a wireless network. When working with wireless networks.

  Difference between von neumann and harvard cpu architectures

What is the difference between von Neumann and Harvard CPU architectures? Provide an example of a commercially available microcontroller using each type of CPU.

  What is the value of the given twos complement number

What is the value of the following 2's complement number? What technique is being utilized when high performance is obtained by subdividing the clock cycle into a number of sub-intervals Pipelining technique.

  Write behavioral vhdl code for a special new flipflop

Write behavioral VHDL code for a special new FlipFlop you have conceived of -this FlipFlop has a second data input called Toggle(T).

  An asynchronous sequential logic circuit is given on page

an asynchronous sequential logic circuit is given on page by its primitive flow map i.e. initial state table where x1

  What are benefits of certification in general

What are benefits of certification in general? Do you think it is worthwhile for most project managers to get certified? Is it something you would consider?

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd