A very simple menu driven program written in C# to convert mass and time.
I am currently accepting programming work, it projects, school and application development.
programming projects, thesis and capstone projects, IT consulting.
work, computer tutorials, and web development work kindly contact me in the following email address for further details. If you want to advertise on my website kindly contact me also in my email address also. Thank you.
work, computer tutorials, and web development work kindly contact me in the following email address for further details. If you want to advertise on my website kindly contact me also in my email address also. Thank you.
My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.
My mobile number here in the Philippines is 09173084360.
My telephone number at home here in Bacolod City, Negros Occidental Philippines is +63 (034) 4335675.
Here in Bacolod I also accepting computer repair, networking and Arduino Project development at a very affordable price.
My personal website is http://www.jakerpomperada.com
My personal website is http://www.jakerpomperada.com
Sample Program Output
Program Listing
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Mass_Time_Converter
{
class Program
{
static void Main(string[] args)
{
bool repeat = true;
int num;
int num1;
int con;
while (repeat)
{
Console.WriteLine("\n");
Console.WriteLine("\t===== MAIN MENU =====");
Console.WriteLine("\n");
Console.WriteLine("\tSelect one to convert")
Console.WriteLine("\n");
Console.WriteLine("\t[1] Mass Conversion");
Console.WriteLine("\t[2] Time Conversion");
Console.WriteLine("\n");
Console.Write("\tYou choose: ");
con = Convert.ToInt32(Console.ReadLine());
if (con == 1)
{
Console.WriteLine("\tConvert Mass");
Console.WriteLine("\t1. Kilograms to Grams");
Console.WriteLine("\t2. Grams to Miligrams");
Console.WriteLine("\t3. Milligrams to Micrograms");
Console.WriteLine("\n");
Console.Write("\tYou choose what to convert: ");
num = Convert.ToInt32(Console.ReadLine());
if (num == 1)
{
Console.Write("\tEnter Number: ");
num1 = Convert.ToInt32(Console.ReadLine());
int ans = num1 * 1000;
Console.WriteLine(+num1 + " kilogram/s is equivalent to " + ans + " gram/s.");
Console.WriteLine("\tDo you want to convert again?");
Console.WriteLine("\n");
Console.WriteLine("\tContinue Yes or No?");
string ask = Console.ReadLine();
if (ask.ToLower() != "yes")
{
repeat = false;
Console.WriteLine("\tThank you for using this software.");
}
}
else if (num == 2)
{
Console.Write("\tEnter Number: ");
num1 = Convert.ToInt32(Console.ReadLine());
int ans1 = num1 * 1000;
Console.WriteLine(+num1 + " gram/s is equivalent to " + ans1 + " milligram/s.");
Console.WriteLine("\tDo you want to convert again?");
Console.WriteLine("\n");
Console.WriteLine("\tContinue Yes or No?");
string ask = Console.ReadLine();
if (ask.ToLower() != "yes")
{
repeat = false;
Console.WriteLine("Thank you!");
}
}
else if (num == 3)
{
Console.Write("\tEnter Number: ");
num1 = Convert.ToInt32(Console.ReadLine());
int ans2 = num1 * 1000;
Console.WriteLine(+num1 + " milligram/s is equivalent to " + ans2 + " microgram/s.");
Console.WriteLine("\tDo you want to convert again?");
Console.WriteLine("\n");
Console.WriteLine("\tContinue Yes or No?");
string ask = Console.ReadLine();
if (ask.ToLower() != "yes")
{
repeat = false;
Console.WriteLine("\tThank you for using this Software");
}
}
else
{
Console.WriteLine("\tError! Operation Not Found!");
Console.WriteLine("\tDo you want to convert again?");
Console.WriteLine("\tContinue Yes or No?");
string ask = Console.ReadLine();
if (ask.ToLower() != "yes")
{
repeat = false;
Console.WriteLine("\tThank you!");
}
}
}
else if (con == 2)
{
Console.WriteLine("Choose what to convert");
Console.WriteLine("1. Minutes to Seconds");
Console.WriteLine("2. Hours to Minutes");
Console.WriteLine("3. Days to Hours");
Console.Write("You choose what to convert: ");
num = Convert.ToInt32(Console.ReadLine());
if (num == 1)
{
Console.Write("Enter Number: ");
num1 = Convert.ToInt32(Console.ReadLine());
int ans3 = num1 * 60;
Console.WriteLine(+num1 + " minute/s is equivalent to " + ans3 + " second/s.");
Console.WriteLine("Do you want to convert again?");
Console.WriteLine("Yes or No?");
string ask = Console.ReadLine();
if (ask.ToLower() != "yes")
{
repeat = false;
}
else
{
Console.WriteLine("Thank you!");
Console.ReadKey();
}
}
}
}
}
}
}
No comments:
Post a Comment