OneCompiler

write a hello world program

1644

/*Task 1b - Write a program that implements parameterized constructor.

Problem Description -

Create a class named ParamConstructor. The class should have two fields
Student Id and Student Name.Create two constructors one default
constructor set some default vlaues of your choice. The parameterized
constructor should be defined such that it takes the values of Student ID
and Student Name based on user input.

Methods to display the student details -

Create method showDetails1() to display the information passed through
default constructor.

Create method showDetails2() to display the information passed through parameterized
constructor.

Main Method -

Create object of the ParamConstructor class and invoke methods to display the student details.

Input Format -
The first line of input should consist an integer for Student ID
The second line of input should consist of String for Student's name.

Output Format -
The output should display the student details as passed by the default constructor and the parameterized constructor

Note -
The name of the student can consist of three parts First Name , Middle Name, Last Name.
In such cases all those three parts of the name shold be displayed separately.

Sample test case -

Input = 300
John Michael Doe

Output =
The Default value of the student is:
Sid: 125
Sname: Sindhu

Sid: 300
Name of the Student is:
firstname: John
middlename: Michael
lastname: Doe

input=500
Akash
output=
The Default value of the student is:
Sid: 125
Sname: Sindhu
Sid: 500
Name of the Student is:
firstname: Akash

*/
// Write your code from the next line