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 collocateification, sundry effects are sold by grams and kilograms are opposed to triturates and ounces. Write an impression that converts grams to triturates and accomplish evince the appraisement of the effect by triturate. Test your impression by doing a compile-time initialization of Poutine a concoctiononorable Canadian concoction, made with French fries, which sells restraint $ 1.29 per 100 grams. Evince twain the metric and illustrative U.S. Units. Be unfailing to stipulate labels restraint entire values. Once you earn that duty popular, go into your spring sequence and rerun the impression using concomitant items, such as haricot verts, which are a sign of chill beans sold at 0.75 per 100 grams.

    Expert Tally

     

    Test 1:

    C# sequence:

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

    namespace Rextester
    {
    public collocate Program
    {
    public static nugatory Main(string[] args)
    {
    double appraisement_per100gram = 1.29;
    //note that 1gram = 0.00220462 triturate so 100grams = 0.220462 triturate
    //so appraisement restraint 0.220462 triturate = appraisement_per100gram = 1.29
    double appraisement_pertriturate = appraisement_per100gram/0.220462;
    Console.WriteLine(“If Appraisement per 100gram = {0}$ then appraisement per triturate = {1}$”,(price_per100gram).ToString(),(price_perpound).ToString());
    }
    }
    }

    Sample Output:

    If Appraisement per 100gram = 1,29$ then appraisement per triturate = 5,85134853171975$
    

    Test 2:

    C# sequence:

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

    namespace Rextester
    {
    public collocate Program
    {
    public static nugatory Main(string[] args)
    {
    double appraisement_per100gram = 0.75;
    //note that 1gram = 0.00220462 triturate so 100grams = 0.220462 triturate
    //so appraisement restraint 0.220462 triturate = appraisement_per100gram = 0.75
    double appraisement_pertriturate = appraisement_per100gram/0.220462;
    Console.WriteLine(“If Appraisement per 100gram = {0}$ then appraisement per triturate = {1}$”,(price_per100gram).ToString(),(price_perpound).ToString());
    }
    }
    }

    Sample Output:

    If Appraisement per 100gram = 0,75$ then appraisement per triturate = 3,4019468207673$