Create a program that receives a student's name as input and then outputs a three-character ID for thatstudent. This three-character ID would be used to create a longer, unique ID but that is not a part of thisparticular program.Prompt the user to enter a student's name. You can assume that the student's name will have either twoor three parts to it, i.e. it will either be first-name last-name or first-name middle-name last-name.The ID is created as follows. If the user enters a three partname, the ID number is created by takingtheir initials, i.e. the first character of each part of the name, converted to lower-case characters wherenecessary. For example, the name “David Robert Jones" would lead to an ID of drj.If the user enters a two-part name, the ID is again created by taking their initials, converted to lower-casecharacters where necessary, but this time substituting an “x" character for the missing middle name. Forexample, the name “Richard Starkey" would lead to an ID of rxs.All upper-case letters must be converted to lower-case in the ID.Your class must contain the following method:public StringcreateID(String input)This method receives the input name as a single String and returns the generated ID as a String.If the input string is not valid then this method should return the value null. The input is not valid if:It is null.It is empty.It does not contain either two or three parts.

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter9: Records (struct)
Section: Chapter Questions
Problem 2PE
icon
Related questions
Question

Create a program that receives a student's name as input and then outputs a three-character ID for thatstudent. This three-character ID would be used to create a longer, unique ID but that is not a part of thisparticular program.Prompt the user to enter a student's name. You can assume that the student's name will have either twoor three parts to it, i.e. it will either be first-name last-name or first-name middle-name last-name.The ID is created as follows. If the user enters a three partname, the ID number is created by takingtheir initials, i.e. the first character of each part of the name, converted to lower-case characters wherenecessary. For example, the name “David Robert Jones" would lead to an ID of drj.If the user enters a two-part name, the ID is again created by taking their initials, converted to lower-casecharacters where necessary, but this time substituting an “x" character for the missing middle name. Forexample, the name “Richard Starkey" would lead to an ID of rxs.All upper-case letters must be converted to lower-case in the ID.Your class must contain the following method:public StringcreateID(String input)This method receives the input name as a single String and returns the generated ID as a String.If the input string is not valid then this method should return the value null. The input is not valid if:It is null.It is empty.It does not contain either two or three parts.

Expert Solution
steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Function Arguments
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.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,