TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Maha
NA
0
328.3k
Please modified the program
Aug 5 2012 9:32 PM
This is Question 3 of the Exercise (pdf page 6). How could this program be modified? So that if user entered non numeric value program must end.
using System;
namespace CheckLowRate
{
class EnsureValidPayRate
{
static void Main(string[] args)
{
double payRate;
payRate = HourlyPayRate();
while (true)
{
if (49.99 > payRate && payRate > 5.65)
{
Console.WriteLine("{0} Acceptable", payRate.ToString("C"));
}
if (49.99 < payRate || payRate < 5.65)
{
Console.WriteLine("{0} Not Acceptable", payRate.ToString("C"));
}
payRate = HourlyPayRate();
}
Console.WriteLine("Program Ends");
Console.ReadKey();
}
public static double HourlyPayRate()
{
Console.Write("\nHourly Pay Rate is $");
double HpayRate = Convert.ToDouble(Console.ReadLine());
return HpayRate;
}
}
}
Attachment:
chapter5-exercises.zip
Reply
Answers (
10
)
Run multiple forms at once
How to Display oblige symbol of db field amount in crystal Report