Object Orientation – C # – Set Default Offer Values ​​in DolarAmericano and DolarCanadense Properties

My code relates to the conversion of the Brazilian real into US and Canadian dollars. I was wondering how to enter the following values ​​in the DolarAmericano and DolarCanadense properties instead of asking the user to enter the price value for both types of currency.

Values ​​to enter in properties

DolarCanadense = 3,15;

DolarAmericano = 4,13;

Conversion code

using System.Globalization;
using static System.Console;

public class Conversao
    public decimal Valor { get; set; }
    public decimal DolarAmericano { get; set; }
    public decimal DolarCanadense { get; set; }

    public decimal GetDolarReal(decimal dolaramericano, decimal valor)
        decimal dolarreal = valor * dolaramericano;
        return dolarreal;

    public decimal GetEuroReal(decimal dolarcanadense, decimal valor)
        decimal canadensereal = valor * dolarcanadense;
        return canadensereal;

    public string ToString(decimal dolaramericano, decimal dolarcanadense, decimal dolar)
        decimal Valor1 = GetDolarReal(dolaramericano, Valor);
        decimal Valor2 = GetEuroReal(dolarcanadense, Valor);
        return "Real: " + Valor.ToString("C", CultureInfo.CreateSpecificCulture("pt-BR")) + " |" +
        " Dólar Americano: " + DolarAmericano.ToString("C", CultureInfo.CreateSpecificCulture("en-US")) + " |" +
        " Dólar Canadense: " + DolarCanadense.ToString("C", CultureInfo.CreateSpecificCulture("en-CA"));


public class AppConversao
    static int Main(string() args)
        Conversao() conversao = new Conversao(3);
        decimal() ValorDolarAmericano = new decimal(3);
        decimal() ValorEuroBritanico = new decimal(3);
        int i = 0;

        for (i = 0; i < conversao.GetLength(0); i++)
            conversao(i) = new Conversao();
            Write($"Digite o nome do {i + 1}ª conversão: ");
            if (!decimal.TryParse(ReadLine(), out decimal digitevalor)) return 1;
            conversao(i).Valor = digitevalor;
            ValorDolarAmericano(i) = conversao(i).GetDolarReal(conversao(i).DolarAmericano, conversao(i).Valor);
            ValorEuroBritanico(i) = conversao(i).GetEuroReal(conversao(i).DolarCanadense, conversao(i).Valor);;

        for (i = 0; i < conversao.GetLength(0); i++)
            WriteLine($"{i + 1}ª conversão: {conversao(i).ToString(conversao(i).Valor, conversao(i).DolarAmericano, conversao(i).DolarCanadense)}");
        return 0;

pathfinder 1e – Can we use a wonderful object to make a scroll?

A prerequisite to the spell can be provided by a character who prepared the spell (or who knows the spell in the case of a wizard or a bard), or by using a magic object completing a spell or a spell trigger or a spell-like ability producing the desired spell effect. For each day that passes through the creation process, the creator must use a spell completion item or a spell trigger item if any of these objects is used to provide a prerequisite. .

From the rules explaining the magic element description format, in the requirements section. As speed boots are not a completing element or spell trigger, they can not be used to create another magic object, such as a roll of haste.

From a roll is a spell element, several hasty rolls could be used to produce speed boots. It would be extremely expensive and is not recommended.

Note that you can ignore the spell requirements of a magic object with a Spellcraft control.

physical – 2D collision response for any object; Where do I start?

I use SFML to write a basic 2D physics simulation. I've already written movement and rotation as well as collision detection algorithms. But I need help with some parts of the crash code.

I do not have the source code at the moment because I write from my phone, but here's how my code is formatted:

– Physics.h

– Physics.cpp

– Collision.h

– Collision.cpp

– main.cpp

My problems are:

  • To detect collisions between all created instances, I saved a list of physics pointers in the directory. Physics.cpp file
std::list allInstances;
//the rest of the code..

And in the class constructor, I added the class pointer to the list. So, my collision function would check the collision with all physical instances created in a loop. Is this a correct approach?

  • I still do not know how to write a collision response algorithm. As any sprite is valid, my algorithm should be independent of the form. But I do not know where to start! Any source or information would be appreciated. Here is what we know about each physical object:
    1. Position, Velocity and Accelerattion vectors.
    2. Circular acceleration and circular velocity floats, as well as the origin of the vector Rotation.

Any general orientation or reference to existing algorithms would help me a lot! Thank you

dnd 5th – In RAW, can you use your free object interaction while performing the action "Use an object"?

There is a drinking contest between a dwarf and a halfling to see who can drink the fastest beer flags. Normally, one might assume that the dwarf would have an advantage to drink, but without their knowledge, the Halfling is a thief.

Rules to interact with objects around you

Here are some examples of what you can do with your movement and action:

  • drink all the beer in a bottle

From the rules of action Use an object:

You normally interact with an object while doing something else, for example, when you pull a sword as part of an attack. When an object requires your action for its use, you perform the action Use an object. This action is also useful when you want to interact with multiple objects in your turn.

A person using the action Can an object drink 2 flags of beer in one action?

Can a thief use Use Object, then use fast hands to use an item again, and then move to 0 feet by drinking 5 flags of beer in one turn?

In the quote above, I put an italicized sentence, does that limit you to an object-by-turn interaction, or is it an explanation why someone l & # 39; 39 will use a day when it can interact with objects for free?

Note: I know that by using the Surge action, you can drink even more beer flags in a round, this is not a question of optimization, beer consumption does not matter. Is just one example. If you want to introduce a more powerful champion, then go ahead, after the question is answered :]

Also note: I am interested in the official rules. This means RAW reading to the best of your ability, supported by RAI if you wish. If you want to provide rules about interacting with objects, please do so after addressing RAW / RAI.

javascript – Gets an object with NULL values ​​from an array of nested objects

let headers = ({
    title: 'Arun',
    id: 'arunId',
    onClick: 'onClickArun'
    title: "George",
    id: 'georgeId',
    onClick: '',
    children: ({
        title: 'David',
        id: 'davidId',
        onClick: 'onClickDavid'
        title: 'Patrick',
        id: 'patrickId',
        onClick: 'onClickPatrick'
    title: 'Mark',
    id: 'markId',
    onClick: 'onClickMark'

const headersMap = ({
}) => (onClick ? {
} : _.map(children, headersMap));

const headersFlatMap = _.flatMap(headers, headersMap);

const headerObj = _.reduce(_.map(headersFlatMap, 'onClick'), (ac, a) => ({ ...ac,
  (a): null
}), {});


How to efficiently download SAP Business Object Reports in the SharePoint Online Document Library

Battery Exchange Network

The Stack Exchange network includes 175 question-and-answer communities, including Stack Overflow, the largest and most reliable online community on which developers can learn, share knowledge and build their careers.

Visit Stack Exchange

dnd 5th – Throwing light on an object

The rules are not specific enough for a precise answer. I would not expect every element of the object to always emit light, because that would allow you to break an element and use it as if you had dozens or even hundreds active light spells. There are actually only two levels of light in this edition of D & D: bright and dark. You could not expect that only one big fragment would be it and a smaller fragment would be even darker.

This would be the decision of the DM. The two most likely results I would expect are:

  1. The spell of light ends because the object on which it was launched no longer exists as such.
  2. The larger fragment of the shattered article continues to have the active light spell while the other fragments stop shining.

Unity – How to make sure that an object looks at an angle in a field of view from top to bottom?

Since my gaze is directed up and down and I know the angle under which I want to look, how can I make sure that an object of play is interested in this angle? I currently have a code like this:

if (directionX != 0 && directionZ != 0)
    transform.rotation = Quaternion.LookRotation(new Vector3(directionX / 2, 0, directionZ / 2));
else if (directionX != 0 || directionZ != 0)
    transform.rotation = Quaternion.LookRotation(new Vector3(directionX, 0, directionZ));

which allows me to look in 8 directions. I am now looking to make sure that I can look in any angle and at any angle using:

var angle = Mathf.Atan2(directionZ, directionX) * Mathf.Rad2Deg;

but I do not know how to use it for my object to look at this angle.

object oriented – The concept of encapsulation

I struggle to understand the concept of encapsulation.

Would you please explain it a little more in detail?

What interfaces, what objects? What's an interface? How do you communicate between objects while still maintaining encapsulation? Are you still going to create a manager class between the objects to manage their communication? What if you have multiple objects that need to communicate?

If the program has objects and is manipulated, is this the right time to create a manager object?

We want to avoid spaghetti code, but how do you do it with Encapsulation? The object methods and their properties may be private, but some of them must be public to be modified or updated or modified one way or another by the program. . Do you create management objects for communication between objects, to manage objects or both?

If we say that objects "know nothing" of other objects, does that mean that they simply do not access the methods or properties of others?

Is it a good idea to use abstract management objects for any concrete object interaction, be it communication or manipulation?

unity – Behavior CapsuleCast / Collision inconsistent when a game object is selected

My gameobject has a CapsuleCollider and I use CapsuleCast to check for horizontal collisions when moving horizontally so that it does not pass obstacles.
It works 100% of the time except when I select the game object in Hierarchy.

When I've selected the game object, whenever I try to hit a wall constantly, it will tremble until it passes through the wall. But this only happens when the object is selected in the hierarchy. If I click on the scene so that the object is not selected and I do exactly the same thing (banging a wall permanently), there is no shake / jitter and it does not pass through the wall, no matter how long I hit him.

This passage in the wall during the selection is also consistent. One hundred percent of the time it will pass when I selected it (and shakes) and one hundred percent of the time it does not do it if I do not have the selected object. Should the selection of an object not have any effect on that? Please give me some ideas of why.