Digital FXtbook
Easy Contacts
  • Home
    • Free Software
    • The Author
    • Former Students Hall of Fame
    • A tribute....
  • Adobe
    • Photoshop >
      • Introduction
      • Selection Tools >
        • Melonhead >
          • Melonhead Creative
        • Breakfast Lunch or Dinner
        • Blu 42
      • Painting Tools >
        • Invisi-World
        • Image Adjustment
        • FreeStyle project
      • Drawing Tools >
        • Abstract Expressionism
    • Illustrator >
      • Vector Ninjas
      • Live Art Painting
      • Starting the Pen Tool
      • Apple and Pear
      • Creating Your LOGO
      • Self Portrait
  • Animation
    • AutoDesk
    • Introduction: The Temple
    • Troubleshooting Maya
    • Modeling >
      • Nail
      • Fence
      • Hammer
      • House
      • Environment Bubble
    • Rendering
    • Animation >
      • Beginning Animation
      • Animation - Walk Cycle
      • Facial Animation
    • Characters
    • StoryBoarding
    • Story Reels
    • Editing film >
      • Video Editing
    • Troubleshooting
  • Gaming
    • Board Game Game Design Document
    • Modeling >
      • Introduction: The Temple
      • Halo 1 Blood Gulch Base
      • Hammer
      • Sword
      • Character Modeling Big Daddy
      • Shield
      • The OM6G
      • Weapon
      • Character Modeling Legion the Geth
      • Character Modeling Geth Armor
    • Animation >
      • Character Animation
    • Rigging >
      • Rigging with HumanIK
      • Characterizing and MoCap
      • Integration with Unity
    • Unity >
      • Terrain
      • Importing Models
  • Coding
    • Beginning C# >
      • First Unit: Primitive types and Expressions >
        • First Program
        • Introduction Unity Lesson
        • Comments
        • PsuedoCode
        • Numbers and Operators
        • Use of Parenthesis
        • Casting
        • Try and Catch
        • Operators
      • Second Unit: Control Flow >
        • Conditional Statements >
          • Number validator
          • Number tester
          • Speed Camera
        • Loops >
          • While Loops
          • For Loops
          • Do While Loops
      • Number Wizard Game #1
      • Second Unity Game: Text Adventure
      • Number Wizard Game GUI
    • Intermediate C#
    • Web Design >
      • XHTML >
        • XHTML Introduction
        • XHTML Test #1
        • HTML Links and Images
        • XHTML Test #2
        • HTML Tables and Lists
        • XHTML Test #3
        • HTML intro to CSS
        • HTML CSS
        • HTML Styling
        • HTML Styles
      • Java Script >
        • Java Script 1
        • Java Script 2
        • Java Script 3
        • Java Script 4
        • Java Script 5
        • Java Script 6
        • Java Script 7
        • Java Script 8
      • HTML 5 >
        • HTML 5 Advanced 1
        • HTML 5 Advanced 2
        • HTML Advanced 3
        • HTML Advanced 4
        • HTML Advanced 5
        • HTML Advanced 6
        • HTML Advanced 7
        • HTML Advanced 8
        • HTML Advanced 9
        • HTML Advanced 10
        • HTML Advanced 11
  • Links
    • Key Board Fix/Hack
    • Buiding Piers >
      • Buiding Piers
      • Buiding Piers
    • The Top Six Animation Schools
    • The Top Video Game Design Schools
  • Films
    • Harrison and Javier's film
    • Emily's new film
    • Huy and Karley's film
  • BPA
    • BPA 2017-2018 >
      • Getting organized
      • Building the Train
      • Texturing the Train
      • Animating the Train
      • Making our Entry Film

Use of Parentheses 

An important bit of code in C# are Parentheses. Knowing when to use them, when not use them, and using them correctly in code is an important skill that young coders must understand. So in the exerciser below we are going to try and the correct desired out put by making sure that we place parentheses where they should and leaving them out when they are not needed. Your mission to to correct the code below so that we get the results that we need. Try to fix the code before running the program. 
​

Pre-Assignment Videos

The Code

using System;

namespace Parenthesis
{
    class Program
    {
        static void Main(string[] args)
        {
            {
                int v = 2;
                int result = v + 1 * 2;
                Console.WriteLine("result: " + result + " expected result : 6");
                result = v + 1 * v + 2 * 2;
                Console.WriteLine("result: " + result + " expected result : 24");
                result = v - 1 * 2 + 2 * 2;
                Console.WriteLine("result: " + result + " expected result : 6"); 
                result = v + v * v + v * 2;
                Console.WriteLine("result: " + result + " expected result : 32"); 
                result = v / 2 * v + 2 * 2;
                Console.WriteLine("result: " + result + " expected result : 4"); 
            }
        }
    }
}
​

The results that we are after

result: 6         expected result : 6
result: 24       expected result : 24
result: 6         expected result : 6
result: 32       expected result : 32
result: 4         expected result : 4
Proudly powered by Weebly