Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
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