Solucionado (ver solução)
Solucionado
(ver solução)
7
respostas

Minha Resolução

sei que ainda tem problema para ser resolvido, aceito sugestões na parte que corresponde ao pedido amount, fazer ele conversar com o itemPedido.full

7 respostas
Program.cs



using CompraFacil;
using CompraFacil.AddressClient;
using CompraFacil.Client;
using CompraFacil.Orders;
using CompraFacil.OrdersItems;

Customer client = new Customer();
client.customerId = 0001;
client.name = "Seuze da Esquina";
client.email = "seuze@fecticio.com";
client.cpf = "98765432101";
client.phone = "11999998888";

Address endereco = new Address();
endereco.state = "Magico de Oz";
endereco.city = "Literatura";
endereco.zip = "12121832";
endereco.neighborhood = "Faz de comta";
endereco.street = "Tijolos de Ouro";

Order pedido = new Order();
pedido.product = "PC Gamer";
pedido.amount = "4un";

OrderItem itemPedido = new OrderItem();
itemPedido.requestNumber = 0001;
itemPedido.full = 3;
itemPedido.freight = 25.00;
itemPedido.formOfPayment = "cartao de credito";
itemPedido.dateOrder = "20230323";


if(itemPedido.full <= 3)
{
    Console.WriteLine("__________Pedido do cliente__________");
    Console.WriteLine("Nome Completo " + client.name);
    Console.WriteLine("Endereço " + endereco.street);
    Console.WriteLine("nº Pedido " + itemPedido.requestNumber);
    Console.WriteLine("Pedido " + pedido.product);
    Console.WriteLine("total de item " + itemPedido.full);

    Console.WriteLine("Compra realizada com sucesso");
}
else
{
    Console.WriteLine("Quantidade exedeu o limite");
}





Console.WriteLine();
Console.WriteLine("Pressione enter para sair...");
Console.WriteLine("xD");
Console.ReadKey();


OrderItem.cs



using CompraFacil.Client;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CompraFacil.OrdersItems
{
    internal class OrderItem
    {
        public int requestNumber;

        public double freight;
        public string formOfPayment;
        public string dateOrder;

        public double full;

        public bool itemTotal(double item)
        {
            if(item <= full)
            {
                item -= full;
                return true;
            }
            else
            {
               item += full;
                return false;
            }
        }

    }
}
classe Order.cs



using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CompraFacil.Orders
{
    internal class Order
    {
        public string product;
        public string amount;
    }
}
 //Classe Address.cs


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CompraFacil.AddressClient
{
    internal class Address
    {
        public string street;
        public string city;
        public string state;
        public string neighborhood;
        public string zip;
        public int houseNumber;
    }
}
//classe cliente.cs


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CompraFacil.Client
{
    internal class Customer
    {
        public int customerId;
        public string name;
        public string cpf;
        public string email;
        public string phone;

    }
}

Vagner, bom dia!

Uau camarada, parabéns pela atividade e está muito bom, no decorrer das aulas você vai ver outras técnicas que ajudarão a melhorar ainda mais sua implementação. Continue focado nos estudos!

Abraços e bons estudos 😄


Caso este post tenha lhe ajudado, por favor, marcar como solucionado ✓. Bons Estudos!
solução!

Obrigado Mestre!