Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C# Debugging help // Handles a Format Exception if user does not enter a number using System; using static System.Console; class DebugEleven01 { static void

C# Debugging help

// Handles a Format Exception if user does not enter a number
using System;
using static System.Console;
class DebugEleven01
{
static void Main()
{
double salary;
string salVal;
bool isValidSalary;
while(!isValidSalary)
{
try
Write("Enter an employee's salary ");
salVal = ReadLine();
salary = Convert.ToDouble(salVal);
isValidSalary = true;
catch(Formatexception fe)
{
WriteLine("You must enter a number for the salary");
}
}
WriteLine("The salary {0} is valid", salary.ToString("C2"));
}
}

Step by Step Solution

3.22 Rating (169 Votes )

There are 3 Steps involved in it

Step: 1

using System using static SystemConsole class DebugEleven01 public static void Mai... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Document Format ( 2 attachments)

PDF file Icon
606ad5685c407_47907.pdf

180 KBs PDF File

Word file Icon
606ad5685c407_47907.docx

120 KBs Word File

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Modern Operating Systems

Authors: Andrew S. Tanenbaum, Herbert Bos

4th edition

013359162X, 978-0133591620

More Books

Students also viewed these Programming questions

Question

How is use of the word consistent helpful in fraud reports?

Answered: 1 week ago