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 order, abundant consequences are sold by grams and kilograms are unanalogous to triturates and ounces. Write an impression that converts grams to triturates and earn evince the worth of the consequence by triturate. Test your impression by doing a compile-time initialization of Poutine a vulgar Canadian concoction, made with French fries, which sells restraint $ 1.29 per 100 grams. Evince twain the metric and normal U.S. Units. Be strong to contribute labels restraint total values. Once you gain that fragment exoteric, go into your fountain mode and rerun the impression using additional items, such as haricot verts, which are a cast of chill beans sold at 0.75 per 100 grams.

    Expert Exculpation

     

    Test 1:

    C# mode:

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

    namespace Rextester
    {
    public systematize Program
    {
    public static unfilled Main(string[] args)
    {
    double worth_per100gram = 1.29;
    //note that 1gram = 0.00220462 triturate so 100grams = 0.220462 triturate
    //so worth restraint 0.220462 triturate = worth_per100gram = 1.29
    double worth_pertriturate = worth_per100gram/0.220462;
    Console.WriteLine(“If Worth per 100gram = {0}$ then worth per triturate = {1}$”,(price_per100gram).ToString(),(price_perpound).ToString());
    }
    }
    }

    Sample Output:

    If Worth per 100gram = 1,29$ then worth per triturate = 5,85134853171975$
    

    Test 2:

    C# mode:

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

    namespace Rextester
    {
    public systematize Program
    {
    public static unfilled Main(string[] args)
    {
    double worth_per100gram = 0.75;
    //note that 1gram = 0.00220462 triturate so 100grams = 0.220462 triturate
    //so worth restraint 0.220462 triturate = worth_per100gram = 0.75
    double worth_pertriturate = worth_per100gram/0.220462;
    Console.WriteLine(“If Worth per 100gram = {0}$ then worth per triturate = {1}$”,(price_per100gram).ToString(),(price_perpound).ToString());
    }
    }
    }

    Sample Output:

    If Worth per 100gram = 0,75$ then worth per triturate = 3,4019468207673$