divider

Objective

Ask the user to enter the weight of three items in their backpack. Display the total weight.

Skills to Practice

  • icon Prompting a user for input
  • icon Performing arithmetic
  • icon Formatting text output
divider

Tasks

  • icon Create a new project named sprint-1-6
  • icon Complete the following tasks:
    • icon Prompt the user for three backpack items and their corresponding weight.
    • icon Note that once the item name is given, its name is used in the following prompt for its weight.
    • icon Display the total weight.
divider

Sample Output

Sample Output
Name of item 1: Water Bottle [Enter]
Weight of Water Bottle (lbs): 1 [Enter]
Name of item 2: Laptop [Enter]
Weight of Laptop (lbs): 2 [Enter]
Name of item 3: Snack [Enter]
Weight of Snack (lbs): 0.25 [Enter]
- Weight -
Water Bottle: 1lbs
Laptop: 2lbs
Snack: 0.25lbs
Total weight: 3.25lbs

Begin Sprint