Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- namespace Assignment1Part4
- {
- class Program
- {
- static string productName;
- static double pounds,
- ounces,
- poundTok = 0.454f,
- ounceTok = 0.0283f,
- convertPounds,
- convertOunces,
- totalKiloWeight;
- static void Main(string[] args)
- {
- GetWeight();
- Calculate();
- Display();
- }
- static void GetWeight()
- {
- Console.Write("Please Enter Name of Product: ");
- productName = Console.ReadLine();
- Console.Write("\nPlease Enter Weight of Product (Pounds): ");
- pounds = Convert.ToDouble(Console.ReadLine());
- Console.Write("\nPlease Enter Weight of Product (Ounces): ");
- ounces = Convert.ToDouble(Console.ReadLine());
- }
- static void Calculate()
- {
- convertPounds = pounds * poundTok;
- convertOunces = ounces * ounceTok;
- totalKiloWeight = convertPounds + convertOunces;
- }
- static void Display()
- {
- Console.WriteLine("\nPounds converted to Kilograms: {0}lb", String.Format("{0:0.00}", poundTok));
- Console.WriteLine("\nOunces converted to Kilograms: {0}oz", String.Format("{0:0.00}", ounceTok));
- Console.WriteLine("\nTotal Weight in Kilograms: {0}kg", String.Format("{0:0.00}", totalKiloWeight));
- Console.ReadKey();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement