011-002-007

Constructor Call: Creating Multiple Objects

Easy

Problem Description

constructor Call: Creating Multiple Objects

Learning Objective: Call constructor with new keyword to create objects

In this problem, you will create a program that calls the Student class constructor twice using the new keyword to instantiate two independent student objects, then displays each student's name and score to standard output.

Create a program managing two students' information. Call the Student class constructor with the new keyword to create independent objects for each student.

Input

Line 1: Student 1 name (string)
Line 2: Student 1 score (integer)
Line 3: Student 2 name (string)
Line 4: Student 2 score (integer)

Output

Student 1: [name] - [score] points
Student 2: [name] - [score] points

Examples

Example 1: Basic values

Input:

Taro
85
Hanako
92

Output:

Student 1: Taro - 85 points
Student 2: Hanako - 92 points

Example 2: Different values

Input:

Ichiro
70
Jiro
80

Output:

Student 1: Ichiro - 70 points
Student 2: Jiro - 80 points

Example 3: Boundary values

Input:

A
0
B
100

Output:

Student 1: A - 0 points
Student 2: B - 100 points

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