ClassLearning

mail@pastecode.io avatar
unknown
csharp
2 years ago
3.2 kB
2
Indexable
Never
using System;

namespace LearningCSharp
{
    class Program
    {
        static void Main(string[] args)
        {
            // Default values that will be overriden
            Arrowhead arrowHead = Arrowhead.Steel;
            Fletching fletching = Fletching.Goose;
            int arrowLength = 60;

            // Ask for arrowhead type
            Console.WriteLine("Please select your arrowhead type: Steel, Wool, or Obsidian");
            string arrowHeadSelection = Console.ReadLine();

            // Confirm arrowhead selection matches the three options; then, set enum variable to true answer
            if (arrowHeadSelection != "Steel" || arrowHeadSelection != "Wool" || arrowHeadSelection != "Obsidian")
            {
                Console.WriteLine("Your selection was invalid. Please select your arrowhead type: Steel, Wool, or Obsidian");
                arrowHeadSelection = Console.ReadLine();
            }

            if (arrowHeadSelection == "Steel")
                arrowHead = Arrowhead.Steel;
            else if (arrowHeadSelection == "Wool")
                arrowHead = Arrowhead.Wool;
            else
                    arrowHead = Arrowhead.Obsidian;


            // Ask for fletching type
            Console.WriteLine("Please select your fletching type: Plastic, Turkey, or Goose");
            string fletchingSelection = Console.ReadLine();

            // Confirm feltching selection matches the three options; then, set enum variable to true answer
            if (fletchingSelection != "Plastic" || arrowHeadSelection != "Turkey" || arrowHeadSelection != "Goose")
            {
                Console.WriteLine("Your selection was invalid. Please select your fletching type: Plastic, Turkey, or Goose");
                fletchingSelection = Console.ReadLine();
            }

            if (arrowHeadSelection == "Steel")
                arrowHead = Arrowhead.Steel;
            else if (arrowHeadSelection == "Wool")
                arrowHead = Arrowhead.Wool;
            else
                arrowHead = Arrowhead.Obsidian;


            // Ask for arrow length, between 60cm and 100cm
            Console.WriteLine("Please select your arrowhead length(cm): between 60 and 100");
            int arrowheadLengthSelection = int.Parse(Console.ReadLine());

            if (arrowheadLengthSelection < 60 || arrowheadLengthSelection > 100)
            {
                Console.WriteLine("We don't offer arrows in those lengths. Please select between 60 and 100.");
                arrowheadLengthSelection = int.Parse(Console.ReadLine());
            }


            // Instantiate class with your selections
            Arrow arrow = new Arrow(arrowHead, fletching, arrowLength);
        }
    }
}

enum Arrowhead { Steel, Wool, Obsidian }
enum Fletching { Plastic, Turkey, Goose }

class Arrow
{
    public Arrowhead _headType;
    public Fletching _fletchingType;
    public int _arrowLength;

    public Arrow(Arrowhead headType, Fletching fletchingType, int arrowLength)
    {
        _headType = headType;
        _fletchingType = fletchingType;
        _arrowLength = arrowLength;
    }

    // Method to calculate cost of arrow
    public int TotalCost()
    {
        
    }
}