27 lines
655 B
C#
27 lines
655 B
C#
namespace _2024._01._06;
|
|
|
|
class Termek
|
|
{
|
|
private List<string> Termekek { get; set;}
|
|
private List<double> Kg { get; set; }
|
|
|
|
public Termek(List<string> termekek, List<double> kg)
|
|
{
|
|
Termekek = termekek;
|
|
Kg = kg;
|
|
}
|
|
|
|
public void Kiiras()
|
|
{
|
|
string[] termekeklista = {"alma", "banán", "körte", "répa", "burgonya"};
|
|
int [] arak = {350, 650, 500, 550, 280};
|
|
int index = 0;
|
|
|
|
foreach (var i in Termekek)
|
|
{
|
|
double ar = arak[Array.IndexOf(termekeklista, i)] * Kg[index];
|
|
System.Console.WriteLine($"{i} ára: {ar} Ft");
|
|
index++;
|
|
}
|
|
}
|
|
} |