001-003-007
Variable Initialization: Hobby Card
Easy
Problem Description
variable Initialization: Hobby Card
In this problem, you will create a program that declares String and int variables, combines a fixed value (category) with values received from standard input (hobby name and years of experience), and displays a formatted hobby card to standard output.
Learning Objective: Master using variables by combining fixed and input values
Create a program that displays a hobby card when you input hobby information. Initialize the category as a fixed value, and receive hobby name and years of experience from input.
Input
Line 1: Hobby name (string)
Line 2: Years of experience (integer)
Output
================================
Hobby Card
================================
Category: Sports
Hobby: [name]
Experience: [years] years
================================
Examples
Example 1: Soccer 5 years
Input:
Soccer
5
Output:
================================
Hobby Card
================================
Category: Sports
Hobby: Soccer
Experience: 5 years
================================
Example 2: Baseball 10 years
Input:
Baseball
10
Output:
================================
Hobby Card
================================
Category: Sports
Hobby: Baseball
Experience: 10 years
================================
Example 3: Tennis 1 year
Input:
Tennis
1
Output:
================================
Hobby Card
================================
Category: Sports
Hobby: Tennis
Experience: 1 year
================================
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