Question: Secret Student Data ==================== type Student struct { Name string RollNo int } type SecretStudent struct { SecretCode string ChunkSize int Length int StudentDetail Student

Secret Student Data ====================

type Student struct { Name string RollNo int }

type SecretStudent struct { SecretCode string ChunkSize int Length int StudentDetail Student }

A teacher want to share details of students to school's management. All the data can be accessed using roll number, name and secret code. The teacher shares this information using go channels. But before writing to channel the teacher modifies secret code according to following rules- 1- You divide the SecretCode in equal size chunks 2- Re-arrange the chunks in reverse order 3- If length is such that it cannot be divided in equal size chunks then you pad the secret code using '0'. Eg: secret code length is 8 and chunk size is 5 so you add "00" in secret code which makes the length 10 and get each chunk of size 5

Write a program in which a go routine 'teacher' takes three SecretStudent objects. Modifies the secret code according to the rules. Convert the object to byte array(using json encoding) and write the byte array to A channel

Another go routine 'management' reads from the channel. Decode the byte array and display the recieved SecretStudent. After that fix the SecretCode and display it.By using GO-LANG.

Here are 2 examples for secretCode modification

Examples1 =========== Input: SecretCode: abcdefghijkl ChunkSize: 4 Length: 12

Output: ijklefghabcd

Examples2 =========== Input: SecretCode: abcdefghijkl ChunkSize: 5 Length: 12

Output: kl000fghijabcde Difficulty: 7/10, Duration: 5hr

- Do not emplement any logic in main - If you have to google any syntax mention in comments - Refactor your code

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!