Section 2. Chapter 14
single
Challenge: Basic Type Conversion
Swipe to show menu
Task
Swipe to start coding
You will calculate the total weight of an order, including the weight of individual items and their packaging, and then convert the total weight to an integer.
- Items weight — multiply the weight of one item by the number of items.
- Packaging weight — multiply the packaging weight per item by the number of items.
- Total weight — add the two results from steps 1 and 2.
- Convert to int — use
Convert.ToInt32()to round the total weight to a whole number. - Print to console — fill each blank with the matching variable or parameter: single item weight, packaging weight per item, item count, total weight as a double, and total weight as an int.
Solution
Everything was clear?
Thanks for your feedback!
Section 2. Chapter 14
single
Ask AI
Ask AI
Ask anything or try one of the suggested questions to begin our chat