TEAM MOTIVATE
Problem 1. Debit Card Number
Write a program, which receives 4 integers on the console and prints them in 4-digit debit card format. See the examples below for the appropriate formatting.
Examples
Input | Output |
---|---|
12 433 1 5331 |
0012 0433 0001 5331 |
9182 4221 12 3 |
0012 0433 0001 5331 |
812 321 123 22 |
0812 0321 0123 0022 |
Problem 2. Rectangle Area
Write a program, which calculates a rectangle’s area, based on its width and height. The width and height come as floating point numbers on the console, formatted to the 2nd character after the decimal point.
Examples:
Input | Output |
---|---|
2 7 |
14.00 |
7 8 |
56.00 |
Problem 3. Miles to Kilometers
Write a program, which converts miles to kilometers. Format the output to the 2nd decimal place.
Note: 1 mile == 1.60934 kilometers
Examples
Input | Output |
---|---|
60 | 96.56 |
1 | 1.61 |
52.1113 | 83.86 |
Problem 5. Character Stats
Write a program, which displays information about a video game character. You will receive their name, current health, maximum health, current energy and maximum energy on separate lines. The current values will always be valid (equal or lower than their respective max values). Print them in the format as per the examples.
Examples:
Input | Output |
---|---|
Mayro 5 10 9 10 |
Name: Mayro Health: ||||||.....| Energy: ||||||||||.| |
Bauser 10 10 10 10 |
Name: Bauser Health: |||||||||||| Energy: |||||||||||| |
Loogi 8 20 2 14 |
Name: Loogi Health: |||||||||............| Energy: |||............| |
Toad 0 5 0 10 |
Name: Toad Health: |.....| Energy: |..........| |
Hints
You can print a character multiple times, using new string(character, count).