011-003-005
Constructor Chain: Account Initialization
Easy
Problem Description
constructor Chain: Account Initialization
Learning Objective: Call another constructor with this()
In this problem, you will create a program that reads a username, initializes account information via constructor chaining using this(), and displays the result to standard output.
Create an Account class. Define a constructor with default values (balance: 0 yen) and a constructor that receives all parameters, then use this() to delegate from one constructor to the other.
Input
Line 1: Username (string)
Output
Username: [username]
Balance: 0 yen
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