answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
kipiarov [429]
2 years ago
14

Create a program named Auction that allows a user to enter an amount bid on an online auction item. Include three overloaded met

hods that accept an int, double, or string bid. Each method should display the bid and indicate whether it is over the minimum acceptable bid of $10. If the bid is greater than $10, display Bid accepted. If the bid is less than $10, display Bid not high enough. If the bid is a string, accept it only if one of the following is true: It is numeric and preceded with a dollar sign. It is numeric and followed by the word dollars. Otherwise, display a message that says Bid was not in correct format.
Computers and Technology
1 answer:
Natasha_Volkova [10]2 years ago
4 0

Answer:

Code implemented on C# below

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");

 

}

 

}

}

}

You might be interested in
George and Miguel are considering opening up a shoe store but first need to do market research. Which one of these is NOT part o
Morgarella [4.7K]
The correct answer is D, Draw conclusions and make decisions for their business based on the research results.
7 0
2 years ago
Read 2 more answers
Given positive integer numInsects, write a while loop that prints that number doubled without reaching 200. Follow each number w
Gre4nikov [31]

Answer:

numInsects = 16

while numInsects < 200:

   print(str(numInsects) + " ", end="")

   numInsects *= 2

Explanation:

*The code is in Python.

Set the numInsects as 16

Create a while loop that iterates while numInsects is smaller than 200. Inside the loop, print the value of numInsects followed by a space. Then, multiply the numInsects by 2.

3 0
2 years ago
array of String objects, words, has been properly declared and initialized. Each element of words contains a String consisting o
Vlad [161]

Answer:

for(String s:words)

   if(s.endsWith("ing"))

 System.out.println(s);

Explanation:

Create an enhanced for loop that iterates through the words array

Check if an element in words ends with "ing" using endsWith() method (Since it is said that strings are lowercase letters, we do not need to check it)

If you find one that ends with "ing", print the element

5 0
2 years ago
Nicole wants to create a database to collect information about videos in her video rental store. She would like to use the datab
Verizon [17]

Answer:

All the field which she has mention has to created by Nichole in her database.

Explanation:

The following fields have to be created in the database

title, rating, actor, and producer rating, director, and actor title, rating, actor 1, actor 2, actor 2, actor 4, producer, and in the stock product number, price, and rating

 

And additional field also has to create movie-length also as integer field which should carry the length of the movie  

Date of release and movie certificate also can be captured so the search engine will be very useful

3 0
2 years ago
Match the careers with the career clusters.
creativ13 [48]
<h2>Answer and Explanation:</h2>

The picture shows the right careers with their respective career clusters.

4 0
2 years ago
Read 2 more answers
Other questions:
  • What infrastructure model provides access to shared computing resources over a network, often the internet?
    13·1 answer
  • What is the area of a parallelogram whose vertices are A(−1, 12) , B(13, 12) , C(2, −5) , and D(−12, −5) ? Enter your answer in
    9·2 answers
  • The video clip on driverless cars explained that brain signals from the individual wearing the headset are converted by computer
    13·2 answers
  • The navigation bar on the left side of ____ view contains commands to perform actions common to most office programs.
    15·1 answer
  • Shaniya has misspelled a scientific name in her biology report. She needs to correct it, but she has no access to a computer. Sh
    13·2 answers
  • Which is true of case-based reasoning (CBR)?
    6·1 answer
  • Consider the following 3-PARTITION problem. Given integers a1; : : : ; an, we want to determine whether it is possible to partit
    10·1 answer
  • The signature area in a cover letter includes the sender's first and last name, followed by his/her job title (if applicable). *
    13·1 answer
  • print_pattern() prints 5 characters. Call print_pattern() twice to print 10 characters. Example output: ***** ***** in python
    7·1 answer
  • daniel wants to buy a computer to use for playing games after work. he loves racing games and wants to make sure his device has
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!