﻿<?xml version="1.0" encoding="utf-8" ?>
<CodeSnippets  xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
    <CodeSnippet Format="1.0.0">
        <Header>
            <Title> Reading double from console </Title>
            <Description> Expansion snippet for reading double from console. </Description>
            <Author>Microsoft Corporation</Author>
            <SnippetTypes>          
                <SnippetType> Expansion </SnippetType>
            </SnippetTypes>
        </Header>
        <Snippet>
            <Declarations>
                <Literal>
                    <ID> Double </ID>
                    <Default> dValue </Default>
                    <ToolTip> Variable to hold double value read from console. </ToolTip>
                </Literal>
            </Declarations>
            <Code Language="vjsharp" Format="CData"><![CDATA[double $Double$ = 0; //variable to store the double value read from console
try
{
    java.io.BufferedReader objBuffReader = new java.io.BufferedReader(
                                            new java.io.InputStreamReader(
                                                java.lang.System.in));

    String strLine = objBuffReader.readLine();
    $Double$ = Double.parseDouble(strLine);
}
catch (java.io.IOException ex)
{
    System.out.println("Error: Invalid IO operation.");
}
catch (java.lang.NumberFormatException ex)
{           
    System.out.print("Error: Invalid number format.");
}
$selected$ $end$
]]>
</Code>
        </Snippet>
    </CodeSnippet>
</CodeSnippets>
