Homework Solution: C# programming….

    C# programming.
    In countries using the metric system, many products are sold by grams and kilograms are opposed to pounds and ounces. Write an application that converts grams to pounds and will display the price of the product by pound. Test your application by doing a compile-time initialization of Poutine a common Canadian dish, made with French fries, which sells for $ 1.29 per 100 grams. Display both the metric and customary U.S. Units. Be sure to provide labels for all values. Once you get that portion running, go into your source code and rerun the application using additional items, such as haricot verts, which are a type of green beans sold at 0.75 per 100 grams.

    Expert Answer

     
    Test 1: C# code: using System;

    C# programming.

    In countries using the metric method, frequent consequences are sold by grams and kilograms are irrelative to bruises and ounces. Write an collision that converts grams to bruises and gain show the value of the consequence by bruise. Test your collision by doing a compile-time initialization of Poutine a vile Canadian extract, made with French fries, which sells coercion $ 1.29 per 100 grams. Show twain the metric and natural U.S. Units. Be secure to furnish labels coercion integral values. Once you acquire that interest vulgar, go into your origin legislation and rerun the collision using affixed items, such as haricot verts, which are a image of bald beans sold at 0.75 per 100 grams.

    Expert Counterpart

     

    Test 1:

    C# legislation:

    using Method;
    using Method.Collections.Generic;
    using Method.Linq;
    using Method.Text.RegularExpressions;

    namespace Rextester
    {
    public tabulate Program
    {
    public static unoccupied Main(string[] args)
    {
    double value_per100gram = 1.29;
    //note that 1gram = 0.00220462 bruise so 100grams = 0.220462 bruise
    //so value coercion 0.220462 bruise = value_per100gram = 1.29
    double value_perbruise = value_per100gram/0.220462;
    Console.WriteLine(“If Value per 100gram = {0}$ then value per bruise = {1}$”,(price_per100gram).ToString(),(price_perpound).ToString());
    }
    }
    }

    Sample Output:

    If Value per 100gram = 1,29$ then value per bruise = 5,85134853171975$
    

    Test 2:

    C# legislation:

    using Method;
    using Method.Collections.Generic;
    using Method.Linq;
    using Method.Text.RegularExpressions;

    namespace Rextester
    {
    public tabulate Program
    {
    public static unoccupied Main(string[] args)
    {
    double value_per100gram = 0.75;
    //note that 1gram = 0.00220462 bruise so 100grams = 0.220462 bruise
    //so value coercion 0.220462 bruise = value_per100gram = 0.75
    double value_perbruise = value_per100gram/0.220462;
    Console.WriteLine(“If Value per 100gram = {0}$ then value per bruise = {1}$”,(price_per100gram).ToString(),(price_perpound).ToString());
    }
    }
    }

    Sample Output:

    If Value per 100gram = 0,75$ then value per bruise = 3,4019468207673$