011-001-004
Constructor Definition: User Registration
Medium
Problem Description
constructor Definition: User Registration
In this problem, you will create a program that defines a User class with a constructor accepting name and email address as parameters, initializes the fields, and displays the registered user information to standard output.
Learning Objective: Understand initialization through constructors
Create a User class that initializes name and email through a constructor.
Input
Line 1: Name (string)
Line 2: Email address (string)
Output
Name: [name]
Email: [email]
Registered!
Example
Input:
Taro
taro@example.com
Output:
Name: Taro
Email: taro@example.com
Registered!
Ready to Try Running Code?
Log in to access the code editor and execute your solutions for this problem.
Don't have an account?
Sign Up