Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Learn Challenge: Basic Type Conversion | Dealing with Data Types
C# Basics
Section 2. Chapter 14
single

single

book 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.

  1. Items weight — multiply the weight of one item by the number of items.
  2. Packaging weight — multiply the packaging weight per item by the number of items.
  3. Total weight — add the two results from steps 1 and 2.
  4. Convert to int — use Convert.ToInt32() to round the total weight to a whole number.
  5. 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

Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
Everything was clear?

How can we improve it?

Thanks for your feedback!

Section 2. Chapter 14
single

single

Ask AI

expand

Ask AI

ChatGPT

Ask anything or try one of the suggested questions to begin our chat

some-alt