30 days of code: Day 2

https://www.hackerrank.com/domains/tutorials/30-days-of-code

Today’s code challenge was to come up with the solve function, in order to output the total cost of a meal including the tax and tip.

tip_percent and tax_percet are integers, but no need to convert to a Double?
By dividing the value by 100.0, we are using “Implicit Type Conversion

class Result
{

    /*
     * Complete the 'solve' function below.
     *
     * The function accepts following parameters:
     *  1. DOUBLE meal_cost
     *  2. INTEGER tip_percent
     *  3. INTEGER tax_percent
     */

    public static void solve(double meal_cost, int tip_percent, int tax_percent)
    {
        double tipCost = meal_cost * (tip_percent / 100.0);
        double taxCost = meal_cost * (tax_percent / 100.0);
        double totalCost = meal_cost + tipCost + taxCost;
        Console.WriteLine(Math.Round(totalCost));
    }

}

class Solution
{
    public static void Main(string[] args)
    {
        double meal_cost = Convert.ToDouble(Console.ReadLine().Trim());

        int tip_percent = Convert.ToInt32(Console.ReadLine().Trim());

        int tax_percent = Convert.ToInt32(Console.ReadLine().Trim());

        Result.solve(meal_cost, tip_percent, tax_percent);
    }
}

30 days of code : Day 1

https://www.hackerrank.com/domains/tutorials/30-days-of-code
Reviewing and brushing up my c# skills via HackerRank's 30 days of code challenge.

int i = 5;
double d = 5.0;
string s = "TestString";

// Read and save an integer, double, and String to your variables.
int intVar = Convert.ToInt32(Console.ReadLine());
double doubleVar = Convert.ToDouble(Console.ReadLine());
string stringVar = Console.ReadLine();

// Print the sum of both integer variables on a new line.
Console.WriteLine(i + intVar);

// Print the sum of the double variables on a new line.
Console.WriteLine((d + doubleVar).ToString("F1"));

// Concatenate and print the String variables on a new line
// The 's' variable above should be printed first.
string concatString = s + stringVar;
Console.WriteLine(concatString);

c# environment variable testing

I’ve used AWS Secret Manager in the past, but no the free solution of environment variables. Super simple console test I did.

First you have to add your desired environment variable.
And then you could just enter the Env Var and get your results.
You MUST restart Visual Studio in order to reflect any updated environment variables, or you’ll find no output as the value will be null.

    internal class Program
    {
        static void Main(string[] args)
        {
            string GetKey(string key)
            {
                string keyRequest = Environment.GetEnvironmentVariable(key);
                return keyRequest;
            }

            Console.Write("Enter key name: ");
            string envVar = Console.ReadLine();

            Console.Write("The key value is: ");
            Console.WriteLine(GetKey(envVar));
            Console.ReadLine();
        }
    }

Back from break

I have kept with my studies on and off, but got in a dilemma on what I want to code next…
Let’s make it clear that I did finish my very first IOS app, distributed privately.
UI part is not looking good, but it is functional and so far bug free.
Speaking of bugs, I found a bug with my first windows app the “ArcheAge Calculator”
Found a quick and dirty? fix.

What’s next on the table.
– Recode the entire bucket list/todo app once .NET MAUI GA is released. SOON!
– Start working on a portfolio with my future projects via github, and my very own blazor published website

Now I need to figure out whether to keep hosting asp.net on the Windows VPS I pay roughly $50USD for, or to migrate and start using Azure?

MVC or MVP or MVVM

MVC ? MVP? MVVM? Which should I use for each project?
Yeah, I get it. Depends on the scope of the project.
After programming for a few months, I am still not comfortable with what to use.
Figured out that for web api’s, it’s common or simpler to stick with MVC.
Other than the above, I’ll just revisit this diagram when I’m a lost lamb.