Run Code
|
API
|
Code Wall
|
Users
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Testing 002
//Rextester.Program.Main is the entry point for your code. Don't change it. //Compiler version 4.0.30319.17929 for Microsoft (R) .NET Framework 4.5 using System; using System.Collections.Generic; using System.Linq; using System.Net; using System.Text; using System.Text.RegularExpressions; using System.Globalization; namespace Rextester { public class Program { public static void Main(string[] args) { Prueba test = new Prueba(); test.Nombre = "Felix De Jesus"; test.Apellido = "Marrugo Palomino"; test.Edad = 27; test.Porcentaje = 12.5m; test.Valor = 10.25f; test.Total = Convert.ToDouble((test.Porcentaje*Convert.ToDecimal(test.Edad)) *Convert.ToDecimal(test.Valor)); int Pru1 = (int)test.Porcentaje; int Pru2 = (int)test.Valor; int Pru3 = (int)test.Total; double Pru4 = Convert.ToDouble(test.Edad); DateTime serverTime = DateTime.Now; // gives you current Time in server timeZone DateTime utcTime = serverTime.ToUniversalTime();// convert it to Utc using timezone setting of server computer TimeZoneInfo tzi = TimeZoneInfo.FindSystemTimeZoneById("Eastern Standard Time"); DateTime localTime = TimeZoneInfo.ConvertTimeFromUtc(utcTime, tzi); // convert from utc to local System.Console.WriteLine("Cartagena de Indias, "+localTime.ToString("dd 'de' MMMM 'de' yyyy", CultureInfo.CreateSpecificCulture("es-CO"))); System.Console.WriteLine("\n"); System.Console.WriteLine("Hola "+test.Nombre+" "+test.Apellido +", Bienvenido al Mundo C#; Estabamos esperandote!"); System.Console.WriteLine("\n"); System.Console.WriteLine("Inicialización de Edad: "+test.Edad+" ==> var Int"); System.Console.WriteLine("Inicialización de Porcentaje: "+test.Porcentaje+" ==> var Decimal"); System.Console.WriteLine("Inicialización de Valor: "+test.Valor+" ==> var Float"); System.Console.WriteLine("Inicialización de Total: "+test.Total+" ==> var Double"); System.Console.WriteLine(""); System.Console.WriteLine("Valor en formato Origen: {0}", test.Valor); System.Console.WriteLine("Valor en formato Moneda: {0:C}", test.Valor); System.Console.WriteLine("Total en formato Punto Fijo: {0:F2}", test.Total); System.Console.WriteLine("Total en formato Númerico: {0:N}", test.Total); System.Console.WriteLine("Edad en formato Hexadecimal: {0:X}", test.Edad); System.Console.WriteLine("Edad en formato Decimal: {0:D5}", test.Edad); System.Console.WriteLine(""); System.Console.WriteLine("Casting de Decimal a Entero: "+Pru1); System.Console.WriteLine("Casting de Float a Entero: "+Pru2); System.Console.WriteLine("Casting de Double a Entero: "+Pru3); System.Console.WriteLine("Casting de Entero a Double: "+Pru4.ToString("0.00")); System.Console.WriteLine("\n"); System.Console.WriteLine("El total en Pesos: "+test.Total.ToString("C", CultureInfo.CreateSpecificCulture("es-CO"))); System.Console.WriteLine("\n"); System.Console.WriteLine("Fecha de la Prueba: "+ localTime.ToString("dd/MM/yyyy hh:mm:ss tt", CultureInfo.CreateSpecificCulture("es-PE")).ToUpper()); } } } public class Prueba { private string nombre, apellido; private int edad; private decimal porcentaje; private float valor; private double total; public string Nombre { get{return nombre;} set{nombre = value;} } public string Apellido { get{return apellido;} set{apellido = value;} } public int Edad { get{return edad;} set{edad = value;} } public decimal Porcentaje { get{return porcentaje;} set{porcentaje = value;} } public float Valor { get{return valor;} set{valor = value;} } public double Total { get{return total;} set{total = value;} } }
run
|
edit
|
history
|
help
0
Please
log in
to post a comment.
code
Datediff in c#
Hello World Sub
7.2 Creating async methods the old way
lovefishhhh
Validation along token stack feature
sdfghnjmkuyhtgrfed
UTC to Ireland time convertion v1.1
13
Interface with same methods
Please log in to post a comment.