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.

Test 1: C# code: using System;

C# programming.

In countries using the metric arrangement, abundant fruits are sold by grams and kilograms are irrelative to pulverizes and ounces. Write an contact that converts grams to pulverizes and earn vault the cost of the fruit by pulverize. Test your contact by doing a compile-time initialization of Poutine a base Canadian dish, made with French fries, which sells control \$ 1.29 per 100 grams. Vault twain the metric and customary U.S. Units. Be infallible to arrange labels control full values. Once you secure that concern floating, go into your fount legislation and rerun the contact using affixed items, such as haricot verts, which are a emblem of exposed beans sold at 0.75 per 100 grams.

Expert Exculpation

Test 1:

C# legislation:

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

namespace Rextester
{
{
public static vacant Main(string[] args)
{
double cost_per100gram = 1.29;
//note that 1gram = 0.00220462 pulverize so 100grams = 0.220462 pulverize
//so cost control 0.220462 pulverize = cost_per100gram = 1.29
double cost_perpulverize = cost_per100gram/0.220462;
Console.WriteLine(“If Cost per 100gram = {0}\$ then cost per pulverize = {1}\$”,(price_per100gram).ToString(),(price_perpound).ToString());
}
}
}

Sample Output:

```If Cost per 100gram = 1,29\$ then cost per pulverize = 5,85134853171975\$
```

Test 2:

C# legislation:

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

namespace Rextester
{
{
public static vacant Main(string[] args)
{
double cost_per100gram = 0.75;
//note that 1gram = 0.00220462 pulverize so 100grams = 0.220462 pulverize
//so cost control 0.220462 pulverize = cost_per100gram = 0.75
double cost_perpulverize = cost_per100gram/0.220462;
Console.WriteLine(“If Cost per 100gram = {0}\$ then cost per pulverize = {1}\$”,(price_per100gram).ToString(),(price_perpound).ToString());
}
}
}

Sample Output:

`If Cost per 100gram = 0,75\$ then cost per pulverize = 3,4019468207673\$`