Programming Homework Help

CIS 22B De Anza College Pure Virtual Function Encrypted Message Lab Report

 

Objective:

Design a program that uses abstract classes. To be completed by same group as last lab.

Assignment:

In cryptography, encryption is the process of encoding a message or information in such a way that only authorized parties can access it. In this lab you will write a program to decode a message that has been encrypted.

Detailed specifications:

Define three classes. Each one should be in a separate file. You can choose to define the class and its functions inline, all in a header file, or have a .h and .cpp file for each class.

  • Abstract base class with the following:
    • A variable to hold an encrypted message. This variable should be a string which is initialized in the constructor.
    • A status variable that will tell whether the message was loaded successfully.
    • A constructor that receives one parameter: a string variable with a file name and uploads its content to the string variable that is supposed to store it.
    • A pure virtual function called decode. This function will be defined in derived classes.
    • A function that prints the message on the screen
  • A derived class that implements a version of decode according to the following algorithm:
    • input character: abcdefghijklmnopqrstuvwxyz
    • decoded character: iztohndbeqrkglmacsvwfuypjx
    • That means each ‘a’ in the input text should be replaced with an ‘i’, each ‘b’ with a ‘z’ and so forth.
  • A second derived class that implements a version of decode accordingalgorithm known as “rotational cypher”. In this encryption method, a key is added to each letter of the original text. For example:
    Cleartext:        A    P    P    L    E
    Key:              4    4    4    4    4
    Ciphertext:       E    T    T    P    I

    In order to decode, you need to subtract 4.

I will provide a program that tests your classes.

The output should be printed on the screen. Attach the output of your program as a comment at the end of your source code.

Turn in:

Encrypted.h, CypherA.h and CypherB.h (corresponding .cpp files optional). Only one person in the group has to turn in the assignment for the group. A screenshot of your tests.

ALL files should have the group # and the names of group members.