Question: The program below encodes a number using the formula below with a secret key: encoded number = ( original number + key ) x 5
The program below encodes a number using the formula below with a secret key:
encoded number original number key x
#include
using namespace std;
Your code for A should be inserted here
int main
Encoder eKey;
int encodedValue, decodedValue;
int value ;
cout "original value: value endl;
encodedValue eKey.encodevalue;
cout "encoded value: encodedValue endl;
decodedValue eKey.decodeencodedValue;
cout "decoded value: decodedValue endl;
return ;
Sample output:
original value:
encoded value:
decoded value:
Implement the Encoder class with the following:
a The class scope with appropriate access specifier labels. marks
b A private data member key integer marks
c A default constructor that initializes the value of key to marks
d A constructor with ONE parameter, that initializes the value of key with the argument.
marks
e A public member function encode that takes a number integer as parameter, and returns
the encoded number integer using formula above with the key value. marks
f A public member function decode that takes a number integer as parameter, and returns
the decoded number integer using the key value. marks
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
