Question
Write c++ .h and .cpp programs for the following UMLs This assignment will give you an oppurtunity to work with inheritance, polymorphism, aggregation, exception handling,
Write c++ .h and .cpp programs for the following UMLs
This assignment will give you an oppurtunity to work with inheritance, polymorphism, aggregation, exception handling, and cryptography. You will create multiple classes that interact through inheritance and aggregation. Create the classes as they are discussed for each task below. Test your work for each task thoroughly before submitting to the corresponding automarker upload slot and moving on to the next task. Each task is evaluated separately, but will rely on the classes you created in previous tasks. The classes you will create for each task are:
Cipher, SubstitutionCipher, Exception, Vigenere
given file:
//main.cpp
#include
#include "Location.h"
#include "MovieFile.h"
using namespace std;
int main()
{
//--------------------------------------------
// Example code: Location class
//--------------------------------------------
Location* loc1 = new Location(30,10);
Location* loc2 = new Location(20,20);
cout computeDistance(*loc2)
cout toString()
delete loc1;
delete loc2;
loc1 = nullptr;
loc2 = nullptr;
//--------------------------------------------
// Example code: MovieFile class
//--------------------------------------------
MovieFile* movie1 = new MovieFile("Black Panther", 120, 350);
cout getFileSize()
movie1->setFileSize(50) ;
cout getFileSize()
delete movie1;
movie1 = nullptr;
return 0;
}
3.1 Task 1: Substitution cipher hierarchy, and the Vigenre cipher There are two major types of classic text ciphers: substitution ciphers and transposition ci- phers. In substitution ciphers, each letter of plaintext is encoded and decoded individually. For this task, you will create a hierarchy of classes representing a generic cipher interface, and implement one concrete substitution cipher: Vigenre 3.1.1 Cipher The Cipher class is an abstract class that describes the basic interface of any cipher. This is an interface class, i.e. it provides no implementation. Create the Cipher class in a file called Cipher.h according to the UML specification below: Cipher +encode (const string&): string +decode(const string&): string A cipher is an algorithm that can encode plaintext, turning it into ciphertext, as well as decode ciphertext, turning it back into plaintext. Abstract Cipher declares two pure virtual func- tions: string encode (const string&) - This function is abstract and must be overridden by the derived classes. The function will receive plaintext (string) as input, encrypt it, and return encrypted ciphertext (string)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started