Answer:
Code implemented on C# below
Step-by-step explanation:
using System;
using static System.Console;
using System.Text.RegularExpressions;
public class Auction
{
static void Main()
{
int intbid;
//declare min bid value
int min=10;
//scan input and conver to int
intbid=Convert.ToInt32(Console.ReadLine());
AcceptBid(intbid,min);
double doublebid;
//scan input and conver to double
doublebid=Double.Parse(Console.ReadLine());
AcceptBid(doublebid,min);
string stringbid;
//scan string
stringbid=Console.ReadLine();
AcceptBid(stringbid,min);
}
public static void AcceptBid(int bid, int min)
{
if(bid<min)
Console.WriteLine("Bid not high enough");
else
Console.WriteLine("Bid accepted");
}
public static void AcceptBid(double bid, int min)
{
if(bid<min)
Console.WriteLine("Bid not high enough");
else
Console.WriteLine("Bid accepted");
}
public static void AcceptBid(string bid, int min)
{
//using regular expression check if string is starting with $ and rest all are numbers
if(bid[0]=='$'&&Regex.IsMatch(bid.Substring(1,bid.Length-1), @"^d+$")){
//if input string is in required pattern convert string to int and check for min
if(Convert.ToInt32(bid.Substring(1,bid.Length-1))<min)
Console.WriteLine("Bid not high enough");
else
Console.WriteLine("Bid accepted");
}
else{
string[] temp= bid.Split(' '); //will split with ' '
if(Regex.IsMatch(temp[0].ToString(), @"^d+$")&&Regex.IsMatch(temp[1].ToString(),"dollars")){
//if input string is in required pattern convert string to int and check for min
if(Convert.ToInt32(temp[0].ToString())<min)
Console.WriteLine("Bid not high enough");
else
Console.WriteLine("Bid accepted");
}
}
}
}