Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

A company wants to transmit data over the telephone, but is concerned that its phones could be tapped. All of the data are transmitted as

A company wants to transmit data over the telephone, but is concerned that its phones could be tapped. All of the data are transmitted as four-digit integers. The company has asked you to write a program that encrypts the data so that it can be transmitted more securely. Your program should read a four-digit integer and encrypt it as follows: Replace each digit by (the sum of that digit plus 7) modulus 10. Then, swap the first digit with the third, swap the second digit with the fourth and print the encrypted integer. Your main duty for this assignment is creating an Encrypt class which includes Encrypt.h and Encrypt.cpp. After finishing the task you can use CISP400V10A2.cpp to test the Encrypt class.

The following is the Encrypt class specification.

1. The Encrypt class has an integer private data member 8 element array named digits. The first four elements (0 ~ 3) are to store the original 4 digits integer and the next four (4 ~ 7) are to store the encrypted data.

2. Encrypt class has several public member functions

a. An Encrypt constructor takes an integer of any digits and stores the last four digits. It encrypts the last four digits, stores the encrypted information, displays a call to the constructor information, and shows the original information and encrypted information. If the inputted number is less than or equal to 0 the integer is set to 9436.

b. A displayOriginalData function does not accept and return any data. It displays the first four elements of the private data member.

c. A storeData function takes an integer and does not return anything. It stores the last four digits of the passed in integer to the first 4 elements of the private data member, encrypts the data and store them in the last 4 elements of the private data member.

d. A displayEncryptedData function does not accept and return any data. It displays the last four elements of the private data member.

This assignment comes with a CISP400V10A2.zip file. It includes two files (CISP400V10A2.cpp and CISP400V10A2.exe). The CISP400V10A2.exe file is an executable file. You can double click the file to get to the expecting result (see the picture below) of this assignment. After you finish your implementation for the Encrypt class (put the declaration of the Encrypt class into Encrypt.h , and implementation of the class into Encrypt.cpp), you can put the CISP400V10A2.cpp, Encrypt.h , and Encrypt.cpp in a project and then you should run to the same result as the CISP400V10A2.exe. Please be awarded that you can adjust only your program (Encrypt.h, and Encrypt.cpp) to generate the required result but not the code in CISP400V10A2.cpp file.

The following is the display of the expecting result.

image text in transcribed

Please document the files(CISP400V10A2.cpp, Encrypt.cpp and Encrypt.h)

here is the code of CISP400V10A2.cpp

/ CISP400V10A2.cpp // Test program for class Encrypt. #include "Encrypt.h" // include definition of class Encrypt #include #include using namespace std;

int main() { Encrypt app1(0), app2(40), app3(4560), app4(6145698),app5(-6); // create Encrypt objects cout

CHsersiSonny Deshtogistudentitert Releaseitestexe ** Ihe default constructor is called and the passed in nunber is 0. XWW The inputed nunber is less than or equal to B. The nunber is reset to 9436 . 83 The original data is 9436 . The encrypted data is b3 61 . w* Ihe default constmuctor is called and the passed in nunber is 48. The original data is 8 b 40 . The encrypted data is 1777. Ihe default constructor is called and the passed in nunber is 4568. The original data is 4566. The encrypted data is 3712. The default constructor is called and the passed in nunber is 6145698. The original data is 5698 . The encrypted data is 6523. The default constructor is called and the passed in nunber is 6, XXX The inputed nunber is less than or equal to B. The nunher is reset to 9436 . The original data is 9436 . The encrypted data is 0361. Reset the app1's data to 180. The original data is 8108. The encrypted data is 7778 . Press any key to continue

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

Main Memory Database Systems

Authors: Frans Faerber, Alfons Kemper, Per-Åke Alfons

1st Edition

1680833243, 978-1680833249

More Books

Students also viewed these Databases questions