0

Why the hell it doesnt work?

using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.IO; namespace Lab1.Step1 { class Dog { private const int VaccinationDuration = 1; public string Name { get; set; } public int ChipId { get; set; } public double Weight { get; set; } public int Age { get; set; } public string Breed { get; set; } public string Owner { get; set; } public string Phone { get; set; } public DateTime VaccinationDate { get; set; } public bool Agressive { get; set; } public Dog() { } public Dog(string name, int chipId, double weight, int age, string breed, string owner, string phone, DateTime vaccinationDate, bool agressive) { Name = name; ChipId = chipId; Weight = weight; Age = age; Breed = breed; Owner = owner; Phone = phone; VaccinationDate = vaccinationDate; Agressive = agressive; } public bool IsVaccinationExpired() { return VaccinationDate.AddYears(VaccinationDuration).CompareTo(DateTime.Now) < 0; } } static void Main(string[] args) { Dog dog = new Dog("Bimas", 1234, 24, 5, "taksas", "Antanas Kavaliauskas," + "+37061485555", new DateTime(2018, 7, 4), true); Console.WriteLine("{0, -10} {1, 5:d} {2, 5:f} {3, 5:d} {4, -16} {5, -12}" + "{6, 8:Y} {7}", dog.Name, dog.ChipId, dog.Weight, dog.Age, dog.Owner, dog.Phone, dog.VaccinationDate, dog.Agressive); Console.Read(); } }

9th Sep 2018, 7:17 PM
Shaitzu15
Shaitzu15 - avatar
5 Antworten
+ 1
There is no comma between the name and the phone number. So this is seen as one argument. The code is working fine "Antanas Kavaliauskas," + "+37061485555" Found the comma but it is before the quote (") so part of the name. https://code.sololearn.com/cMD7SIN0Uo85
9th Sep 2018, 7:56 PM
sneeze
sneeze - avatar
+ 1
a best answer mark would be nice ;-)
9th Sep 2018, 8:20 PM
sneeze
sneeze - avatar
0
but I saw your code and found answer. Thank you a lot!
9th Sep 2018, 8:15 PM
Shaitzu15
Shaitzu15 - avatar
0
I don't know how to thank you... my main problem was with "Main" error, but the error is because I didnt writed "class Program"...
9th Sep 2018, 8:18 PM
Shaitzu15
Shaitzu15 - avatar
0
you mean that "Mark as correct" button?
10th Sep 2018, 8:35 AM
Shaitzu15
Shaitzu15 - avatar