c# - Dog to Human years and vice versa -


itemprop = "text">

I try this example problem where I have to make two underlying conversion operators to make a dog class from a human and vice versa I am doing the opposite Classes need to be taken into the fact that the human year is 7 years of dog. I was told that if the dog is going from human years to years, then to ensure that the type of age is still an int (definitely) and there may be some need to change clearly for this. I do not know how to define the doggahuman. Nam, kuttateamaman.ege, Manavatod. Nam and Manavatod.Ege. I am new to programming, so I have not been used in this format. To begin with, any number will work like 25's human age.

  class human {public string name; Public Eh age; Public Human (name of string, int age) {name = name; Age = age; }} Class dog {public string name; Public Eh age; Public dog (string name, int era) {name = name; Age = age; }} Class ConversionQuestion {static void key (string [] args) {Console.WriteLine ("As a human, {0} will {1}", DogToHuman.Name, DogToHuman.Age); Console.lightline ("as dog, {0} will {1}", Manvatod, name, standardization.edge); Console.ReadLine (); }}   

Sorry about any confusion, I was not fishing for just one answer, and more was looking for how to go about it.

  class conversionQuestion {static void key (string [] args) {: 

Change your ConversionQuestion class to something like this Dog dog = New dog ("Max", 3); Human Human = New Human ("Leonardo", 23); Console. Light line ("as a human, {0} will {1}", dogtouman (dog), name, dogmatuman (dog) .g); Console.light line ("as dog, {0} will be {1}", Manvatode (human) .name, mantovodog (human).); Console.ReadLine (); } Public static human doggroup (dog dog) {new humans (dogs return. Name, (dog.ege * 7)); } Public static dog human disease (human human) {new dog back (human name, (human. Edge / 7)); }}

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -