DEV Community

Pykash
Pykash

Posted on

1 1

UpdationofIdGeneration

User Id Generation :
Joseph’s team has been assigned the task of creating user-ids for all participants of an online gaming compition. Joseph has designed a process for generating the user-id using the participator’s First_name , Last_name ,PIN code and a number N. The process defined by Joseph is as below-
STEP 1:-
Compare the lengths of first_Name abd Last_Name of the participant.
The one that is shorter will be called “Smaller Name “ and the one that is longer will be calles “Longer Name”. If both first_Name and Last_name are of equal Length , then the name that appears later in alphabetical order will be called the “LongerName “.
STEP 2:
The user –id should be generated as below-
Last Letter of the smaller name +Entire word of the longer name +Digit at position N in the PIN when traversing the PIN from left to right +Digit at position N in the PIN when traversing the PIN from right to left.
STEP 3:
Toggle the alphabets of the user-id generated in step-2 i.e upper –case alphabet should become lower-case and lower-case alphebets should become upper –case.
Lets see a few eamples;
Example 1 := if the participates detail as below
First_name=Rajiv
Last_name =Roy
PIN = 560037
STEP1 : Length of Last_Name is less than the Length of first_Name , so the smaller Name is “Roy” and the Longer Name is “Rajiv”
Step2: The user_id will be =”Last Letter of the smaller name +Entire word in the longer name +Digit at position N in the PIN when traversing the PIN from left to right + Digit at Positin N in the PIN when traversing the PIN from right to left =Last Letter Of “Roy” +Entire word in “Rajiv” +6th Digit of PIN from left+6th Digit iof PIN from right.
STEP 3:
Toggle the alphabets of the user-id generated in step-2 i.e upper –case alphabet should become lower-case and lower-case alphebets should become upper –case.

AWS Q Developer image

Your AI Code Assistant

Automate your code reviews. Catch bugs before your coworkers. Fix security issues in your code. Built to handle large projects, Amazon Q Developer works alongside you from idea to production code.

Get started free in your IDE

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay