Public Methods Return Method Signature Type vaid string int void Public Methods Return Method Signature Type Page Page() addSentence(string sentence) getSentenceAt(int index) get NumberOfSentences() 1.2. Write a back-end class called PageManager and save it in a file called Page Manager.cpp. This class must have the following structure: Data Type int Page loadPageFromFile(string void fileName) Protected Members Name S writePageToFile(string fileName, Page page) Public Methods Return Туре char 1.3. Write a back-en class called APM11A1Encryptor and save it in a file called APM11A1Encryptor.cpp. This class must have the following structure: key Method Signature Description encryptACharacter(char character) A default constructor that will initialise SentenceCounter to zero. This method will place add a sentence to the Page. You must make use of the cSentences[] array. This method will retrieve a sentence. This method will return the number of sentences there are on the Page. encryptPage(Page page) setKey(int key) This method must read the content of the specified file into a Page object and return this Page. Description This method must write the content of a Page object into the specified file. This member will store the key that will be used during the encryption process. (You may NOT change the name of this member) Description This method must encrypt the received character by using the key class member and the Caesar Cipher encryption technique. This method will encrypt the content of the received page parameter by making use of the encryptACharacter() method. This method will set the value of the key data member. (You may NOT change the name of the input parameter)
Public Methods Return Method Signature Type vaid string int void Public Methods Return Method Signature Type Page Page() addSentence(string sentence) getSentenceAt(int index) get NumberOfSentences() 1.2. Write a back-end class called PageManager and save it in a file called Page Manager.cpp. This class must have the following structure: Data Type int Page loadPageFromFile(string void fileName) Protected Members Name S writePageToFile(string fileName, Page page) Public Methods Return Туре char 1.3. Write a back-en class called APM11A1Encryptor and save it in a file called APM11A1Encryptor.cpp. This class must have the following structure: key Method Signature Description encryptACharacter(char character) A default constructor that will initialise SentenceCounter to zero. This method will place add a sentence to the Page. You must make use of the cSentences[] array. This method will retrieve a sentence. This method will return the number of sentences there are on the Page. encryptPage(Page page) setKey(int key) This method must read the content of the specified file into a Page object and return this Page. Description This method must write the content of a Page object into the specified file. This member will store the key that will be used during the encryption process. (You may NOT change the name of this member) Description This method must encrypt the received character by using the key class member and the Caesar Cipher encryption technique. This method will encrypt the content of the received page parameter by making use of the encryptACharacter() method. This method will set the value of the key data member. (You may NOT change the name of the input parameter)
Chapter12: Exception Handling
Section: Chapter Questions
Problem 10PE
Related questions
Question
answer in c++
![Public Methods
Return
Type
void
string
int
void
Method Signature
Page()
Public Methods
Return
Type
Page
int
addSentence(string
sentence)
getSentenceAt(int index)
get Number Of Sentences()
1.2. Write a back-end class called PageManager and save it in a
class must have the following structure:
Page
void
Method Signature
loadPageFromFile(string
fileName)
Protected Members
Data
Name
3
writePageToFile(string fileName,
Page page)
Public Methods
Return Method Signature
Type
char
key
1.3. Write a back-end class called APM11A1Encryptor and save it in a file called
APM11A1Encryptor.cpp. This class must have the following structure:
encryptACharacter(char
Description
character)
A default constructor that will initialise
SentenceCounter to zero.
encryptPage(Page page)
This method will place add a sentence to the Page.
You must make use of the cSentences[] array.
This method will retrieve a sentence.
This method will return the number of sentences
there are on the Page.
setKey(int key)
res
This method must read the content of the
specified file into a Page object and return
this Page.
Description
This method must write the content of a
Page object into the specified file.
This member will store the key that will be used during
the encryption process. (You may NOT change the name
of this member)
Description
This method must encrypt the received character
by using the key class member and the Caesar
Cipher encryption technique.
This method will encrypt the content of the
received page parameter by making use of the
encryptACharacter() method.
This method will set the value of the key data
member. (You may NOT change the name of the
input parameter)](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2Fd9171373-499d-4219-b6eb-968144fab7fd%2Fa316312a-513d-4bb6-a0c3-57ee92d883d5%2Felm7g69_processed.png&w=3840&q=75)
Transcribed Image Text:Public Methods
Return
Type
void
string
int
void
Method Signature
Page()
Public Methods
Return
Type
Page
int
addSentence(string
sentence)
getSentenceAt(int index)
get Number Of Sentences()
1.2. Write a back-end class called PageManager and save it in a
class must have the following structure:
Page
void
Method Signature
loadPageFromFile(string
fileName)
Protected Members
Data
Name
3
writePageToFile(string fileName,
Page page)
Public Methods
Return Method Signature
Type
char
key
1.3. Write a back-end class called APM11A1Encryptor and save it in a file called
APM11A1Encryptor.cpp. This class must have the following structure:
encryptACharacter(char
Description
character)
A default constructor that will initialise
SentenceCounter to zero.
encryptPage(Page page)
This method will place add a sentence to the Page.
You must make use of the cSentences[] array.
This method will retrieve a sentence.
This method will return the number of sentences
there are on the Page.
setKey(int key)
res
This method must read the content of the
specified file into a Page object and return
this Page.
Description
This method must write the content of a
Page object into the specified file.
This member will store the key that will be used during
the encryption process. (You may NOT change the name
of this member)
Description
This method must encrypt the received character
by using the key class member and the Caesar
Cipher encryption technique.
This method will encrypt the content of the
received page parameter by making use of the
encryptACharacter() method.
This method will set the value of the key data
member. (You may NOT change the name of the
input parameter)
![Question 1
Lai
Background
You are required to write program that will read a fille, encrypt the content of the file, and then
create a new file that contains the encrypted content.
Your program will make use of the following classes:
Page - This class will be used to represent the content of the file that was read.
PageManager - This class will be used to read page content from and to a fille.
APM11A1 Encryptor-This class will be used to encrypt the content of a file using the Caesar-Cipher
method.
AdvancedAPM11A1Encryptor-This class will be used to encrypt the content of a file using the
Exclusive-OR method.
Caesar Cipher
Caesar was a Roman military and political leader during 100BC to 44BC. In order to make the
communication channels secure during war, he invented an encryption technique called the Caesar
Cipher. The cipher requires a sentence and a key to function properly. Each character in the sentence
was then shifted according to the value of the key. Computer programmers adapted the cipher so that
it can be used in programs. Each alphabet letter is assigned a value. This value is determined by the
position of the letter in the ASCII table. E.g. A=65, B-66, C-67, D-68 .... X=88, Y=89, Z-90. The key is
determined by the person who wants to encrypt the sentence. If you select a key=1, and you have a
sentence="TPG11BT is fun", it will encrypt to: UQH22CU!jt! gvo.
Exclusive OR Encryption
The exclusive-OR method requires a key and a sentence to function properly. The ACII value of each
character in the sentence is exclusive-ORed with the key. E.g. If you select a key-1, and you have a
sentence="TPG11BT is fun", it will encrypt to: UQFOCU!hr!gto.
Below is an example of how to exclusive-OR the character
charx = 'T';
chary=x^1;
NB! Please note that you may not add any additional methods or members to the classes of
question 1.1-1.4.
1.1. Write a back-end class called Page and save it in a file called Page.cpp. This class must have the
Data
туре
string
on Exerci
int
cSentences[]
SentenceCounter
Description
This member will store the sentences on the page.
You may assume that a record will never have more
than 34 sentences.
This member will store the number of sentences on
the page.](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2Fd9171373-499d-4219-b6eb-968144fab7fd%2Fa316312a-513d-4bb6-a0c3-57ee92d883d5%2Fq5bi8z8_processed.png&w=3840&q=75)
Transcribed Image Text:Question 1
Lai
Background
You are required to write program that will read a fille, encrypt the content of the file, and then
create a new file that contains the encrypted content.
Your program will make use of the following classes:
Page - This class will be used to represent the content of the file that was read.
PageManager - This class will be used to read page content from and to a fille.
APM11A1 Encryptor-This class will be used to encrypt the content of a file using the Caesar-Cipher
method.
AdvancedAPM11A1Encryptor-This class will be used to encrypt the content of a file using the
Exclusive-OR method.
Caesar Cipher
Caesar was a Roman military and political leader during 100BC to 44BC. In order to make the
communication channels secure during war, he invented an encryption technique called the Caesar
Cipher. The cipher requires a sentence and a key to function properly. Each character in the sentence
was then shifted according to the value of the key. Computer programmers adapted the cipher so that
it can be used in programs. Each alphabet letter is assigned a value. This value is determined by the
position of the letter in the ASCII table. E.g. A=65, B-66, C-67, D-68 .... X=88, Y=89, Z-90. The key is
determined by the person who wants to encrypt the sentence. If you select a key=1, and you have a
sentence="TPG11BT is fun", it will encrypt to: UQH22CU!jt! gvo.
Exclusive OR Encryption
The exclusive-OR method requires a key and a sentence to function properly. The ACII value of each
character in the sentence is exclusive-ORed with the key. E.g. If you select a key-1, and you have a
sentence="TPG11BT is fun", it will encrypt to: UQFOCU!hr!gto.
Below is an example of how to exclusive-OR the character
charx = 'T';
chary=x^1;
NB! Please note that you may not add any additional methods or members to the classes of
question 1.1-1.4.
1.1. Write a back-end class called Page and save it in a file called Page.cpp. This class must have the
Data
туре
string
on Exerci
int
cSentences[]
SentenceCounter
Description
This member will store the sentences on the page.
You may assume that a record will never have more
than 34 sentences.
This member will store the number of sentences on
the page.
Expert Solution
![](/static/compass_v2/shared-icons/check-mark.png)
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 3 steps
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you
![EBK JAVA PROGRAMMING](https://www.bartleby.com/isbn_cover_images/9781337671385/9781337671385_smallCoverImage.jpg)
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
![EBK JAVA PROGRAMMING](https://www.bartleby.com/isbn_cover_images/9781337671385/9781337671385_smallCoverImage.jpg)
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT