Jessie
Jessie
CC#
Created by Jessie on 7/18/2023 in #help
❔ Assignment
Hi, pretty fresh to C# and im currently working on a assignment wich requires me to make a simple yet functional Inventory System utilizing interfaces, this is a console project, ive been stuck on this for the past few hours, currently my only issue would be how to turn a specific file into a public class so that i can mention it within the main file of the project. These are the files i currently have: IPanel.cs
interface IPanel
{
/// <summary>
/// Gere o input relacionado com o painel
/// </summary>
public void HandleInput();

/// <summary>
/// Função utilizada para imprimir os paineis na consola
/// </summary>
public void Draw();
}
interface IPanel
{
/// <summary>
/// Gere o input relacionado com o painel
/// </summary>
public void HandleInput();

/// <summary>
/// Função utilizada para imprimir os paineis na consola
/// </summary>
public void Draw();
}
Item.cs
public class Item
{
public string name;
public int stock;
public int price;

/// <summary>
/// Construtor da classe Item
/// </summary>
/// <param name="n">nome do item</param>
/// <param name="s">stock do item</param>
/// <param name="p">preço unitário do item</param>
public Item(string n, int s, int p)
{
this.name = n;
this.stock = s;
this.price = p;
}

//revisitar video de conversão de dados
public override string ToString()
{
//reservados 24 espaços para o nome dos items e 3 para o preço
return $"{name, 30} - {price, 5}$ x{stock}";
}
}
public class Item
{
public string name;
public int stock;
public int price;

/// <summary>
/// Construtor da classe Item
/// </summary>
/// <param name="n">nome do item</param>
/// <param name="s">stock do item</param>
/// <param name="p">preço unitário do item</param>
public Item(string n, int s, int p)
{
this.name = n;
this.stock = s;
this.price = p;
}

//revisitar video de conversão de dados
public override string ToString()
{
//reservados 24 espaços para o nome dos items e 3 para o preço
return $"{name, 30} - {price, 5}$ x{stock}";
}
}
28 replies