Answer the question
In order to leave comments, you need to log in
CS7036 Missing argument matching required formal parameter?
using System;
using System.Collections.Generic;
using System.Text;
namespace Laba5_1
{
class First :Second
{
public string name { get; set; }
public string secondname { get; set; }
public First(string str)
{
string[] parts = str.Split(';');
name= parts[0];
secondname = parts[1];
comment = parts[2];
nubmers = int.Parse(parts[3]);
day = (parts[4]);
}
}
using System;
using System.Collections.Generic;
using System.Text;
namespace Laba5_1
{
class Second
{
public string day { get; set; }
public int nubmers { get; set; }
public string comment { get; set; }
}
}
class Program
{
static void Main(string[] args)
{
List list = new List();
using (StreamReader sr = File.OpenText(@"D:\111.txt"))
{
while (!sr.EndOfStream)
{
list.Add(new First(sr.ReadLine()));
}
}
while (true) {
Console.Write(" Enter entry" + " \n");
Console.WriteLine("Add data press 'A'");
Console.WriteLine("Search data, press 'B'");
Console.WriteLine("show all data press 'C'");
Console.WriteLine("Sort 'F'");
Console.WriteLine("View 'D'");
Console.WriteLine("Clear 'Enter'/Back");
switch (Console.ReadKey().Key)
{
case ConsoleKey.A:
Console.WriteLine("Enter data");
stringName = Console.ReadLine();
Console.WriteLine("Enter SecondName");
stringSecondname = Console.ReadLine();
Console.WriteLine("Enter comment");
string Comment = Console.ReadLine();
Console.WriteLine("Enter numbers");
int Nubmers = int.Parse(Console.ReadLine());
Console.WriteLine("Enter day");
stringDay = Console.ReadLine();
if (Name != null && Secondname != null && Comment != null && Day != null)
list.Add(new First{ name = Name, secondname = Secondname, comment = Comment, nubmers = Nubmers, day = Day });
else
{
Console.WriteLine("Write all fields");
}
Console.Clear();
break;
}
Console.WriteLine("Name" + "\t" + "Comment" + "\t" + "SName" + "\t" + "How" + "\t" + "Day");
foreach (First item in list)
{
Console.WriteLine(item.name + "\t" + item.
}
int sum = 0;
foreach (First item in list)
{
sum += item.nubmers;
}
Console.WriteLine("Total number of inputs = " + sum);
list.Sort(delegate (First t1, First t2) // sort
{
return t2.nubmers.CompareTo(t1.nubmers);
});
foreach (First el in list)
{
Console.WriteLine("Day with the highest number of entries=" + el.day);
break;
}
list.Sort(delegate (First t1, First t2) // sort
{
return t1.comment.CompareTo(t2.comment);
});
foreach (First el in list)
{
Console.WriteLine("day with the highest number of words in a comment=" + el.day);
break;
}
}
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question