DotNet-100-PreWork-GitBook
  • DotNet PreWork
  • Part 0: Intro
    • 1.0: Installation
    • 2.0: Getting Started
    • 3.0: Configuration
  • Part 1: HTML Fundamentals
    • Basic Tags
    • H & P Tags
    • Lists
    • Links
    • Images
    • Tables
    • Divs
    • Inputs
    • Forms
    • Sections
    • Articles & Headers
    • Footers
    • Navs
    • iFrames
  • Part 2: CSS Fundamentals
    • CSS Set Up
    • Classes
    • Ids
    • Margins & Padding
    • Fonts
    • Backgrounds
    • Widths & Heights
    • Borders
    • Positions
  • Part 3: C# Fundamentals
    • 1.0: Hello World
    • 2.0: Variables
    • 3.0: Basic Types
    • 3.0a: Types Challenges
    • 3.0b: Types Challenges Answers
    • 4.0: Operators
    • 5.0: Strings
    • 6.0: Booleans
      • 6.0a: Boolean Challenge
      • 6.0b: Challenge Answers
    • 7.0: Conditionals
      • 7.1: Switch Case
      • 7.2: If Statements
      • 7.3: Ternary Expressions
    • 8.0: Numbers
    • 9.0: Loops
      • 9.0a: Loop Challenges
      • 9.0b: Challenge Answers
    • 10.0: Classes and Objects
    • 11.0: Properties
    • 12.0: Useful-Links
Powered by GitBook
On this page
  • What's the Best Type Answers:
  • Bronze Challenge Answer (Example)
  • Silver Challenge Answer (Example)
  • Gold Challenge Answer (Example)
  1. Part 3: C# Fundamentals

3.0b: Types Challenges Answers

In this module we'll provide the answers for the types challenges in the last module.

What's the Best Type Answers:

  • char

  • int

  • decimal

  • float

  • int

  • string

Bronze Challenge Answer (Example)

namespace BasicTypesPractice
{
    class Program
    {
        static void Main(string[] args)
        {
            int lottoNumber;
            int yearGraduatedHighSchool = 1994;

            string fbPost;
            string reTweet = "Yes, I'll retweet that.";

            bool isMarried;
            bool isHappy = true;

            decimal studentLoanAmount;
            decimal bankAccount = 100.0M;

            float amountOfSnow;
            float temperature = 57.5f;

            double latitude;
            double oneThird = 3.33333333d;

            fbPost = "The Patriots are terrible!";

            Console.WriteLine(fbPost);
            Console.WriteLine(temperature);
            Console.WriteLine(oneThird);
        }
    }
}

Silver Challenge Answer (Example)

namespace BasicTypesPractice
{
    class Program
    {
        static void Main(string[] args)
        {

            string fbPost;
            string reTweet = "Yes, I'll retweet that.";
            fbPost = "The Patriots are terrible!";

            Console.WriteLine(fbPost + " " + reTweet);
        }
    }
}

Gold Challenge Answer (Example)

namespace BasicTypesPractice
{
    class Program
    {
        static void Main(string[] args)
        {     
            int bYear = Int32.Parse("1976");       
            Console.WriteLine("I was born in {0}.", bYear);
        }
    }
}
Previous3.0a: Types ChallengesNext4.0: Operators

Last updated 7 years ago