Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

Beginning C# 5.0 Databases

Authors: Vidya Vrat Agarwal

2nd Edition

1430242604, 978-1430242604

More Books

Students also viewed these Databases questions

Question

What main issue did Master Card want exploredBrainjuicer Lab?

Answered: 1 week ago

Question

How does the concept of hegemony relate to culture?

Answered: 1 week ago

Question

Writing a Strong Introduction

Answered: 1 week ago