private static void PrintTuples(Threeuple <string, string, string> firstTuple, Threeuple <string, int, bool> secondTuple, Threeuple <string, double, string> thirdTuple) { Console.WriteLine(firstTuple); Console.WriteLine(secondTuple); Console.WriteLine(thirdTuple); }
static void Main(string[] args) { string[] token = Console.ReadLine() .Split(); string fullName = $"{token[0]} {token[1]}"; string adress = token[2]; string town = token[3]; if (token.Length - 1 > 3) { town += $" {token[4]}"; } Threeuple <string, string, string> personNameAdress = new Threeuple <string, string, string>(fullName, adress, town); string[] token1 = Console.ReadLine() .Split(); string name = token1[0]; int beerLitres = int.Parse(token1[1]); bool drunk = token1[2] == "drunk"; Threeuple <string, int, bool> drunkOrNot = new Threeuple <string, int, bool>(name, beerLitres, drunk); string[] token2 = Console.ReadLine() .Split(); string accOwner = token2[0]; double balance = double.Parse(token2[1]); string bankName = token2[2]; Threeuple <string, double, string> bankInfo = new Threeuple <string, double, string>(accOwner, balance, bankName); Console.WriteLine(personNameAdress.ToString()); Console.WriteLine(drunkOrNot.ToString()); Console.WriteLine(bankInfo.ToString()); }
private static Threeuple <string, string, string> ProccesFirstTuple(string[] firstLine) { var fullName = $"{firstLine[0]} {firstLine[1]}"; var address = firstLine[2]; var town = firstLine.Skip(3).ToArray(); var firstTuple = new Threeuple <string, string, string>(fullName, address, string.Join(" ", town)); return(firstTuple); }
private static Threeuple <string, double, string> ProccesThirdTuple(string[] thirdLine) { var name = thirdLine[0]; var @double = double.Parse(thirdLine[1]); var bankName = thirdLine[2]; var thirdTuple = new Threeuple <string, double, string>(name, @double, bankName); return(thirdTuple); }
public static void Main() { var firstLine = Console.ReadLine().Split(); Threeuple <string, string, string> firstTuple = ProccesFirstTuple(firstLine); var secondLine = Console.ReadLine().Split(); Threeuple <string, int, bool> secondTuple = ProccesSecondTuple(secondLine); var thirdLine = Console.ReadLine().Split(); Threeuple <string, double, string> thirdTuple = ProccesThirdTuple(thirdLine); PrintTuples(firstTuple, secondTuple, thirdTuple); }
private static Threeuple <string, int, bool> ProccesSecondTuple(string[] secondLine) { var name = secondLine[0]; var amountOfBeer = int.Parse(secondLine[1]); var drunk = secondLine[2]; var isDrunk = false; if (drunk == "drunk") { isDrunk = true; } var secondTuple = new Threeuple <string, int, bool>(name, amountOfBeer, isDrunk); return(secondTuple); }