package construction; public class Bid{ private String contractor; private float...

70.2K

Verified Solution

Question

Programming

package construction;
public class Bid{  private String contractor;  private float price;  public Bid(String contractor, float price) {    this.contractor = contractor;    this.price = price;  }  public String getContractor() {    return contractor;   }  public float getPrice()    {    return price;  }}
package construction;public class ContractorBids{
  // assume proper variables and other methods are here  public void winningBid(Bid[] bids, int numBids){    /****************************     * your code would go here *     ****************************/  }}

You are doing renovations on your building, and multiplecontractors have given bids. Given the above Bidand ContractorBids class, write code that shouldgo in the area marked * your code would go here * to complete the“winningBid(Bid[] bids, int numBids)” method. Theoutput should be printed to the console (screen). There arenumBids Bids in the arrayBid[] bids. These items are in locations0 to numBids - 1 of thearray.

Each Bid item should have itscontractor and price output on asingle line. There will be marks for properly right justifying theprice and outputting two decimals. As you areprinting the Bid objects, you should keep track ofthe Bid object with the lowest price. At the endprint the contractor name followed by the price, a finder's fee of10% and the total price.  For example, if theBid array had 3 Bids, a Carl'sConstruction with $40 000, a Pat's Paving for $50 000, and Debbie'sDemolition for $30 000, we would get the following output.

 

Top Bids:

Carl's Construction 40000.00

Pat's Paving 50000.00

Debbie's Demolition     30000.00

The winning bid goes to Debbie's Demolition.

Price: $30000.00 Finder's Fee: $3000.00 Total: $33000.00

Answer & Explanation Solved by verified expert
4.1 Ratings (796 Votes)
Solution Here is the code for the winningBid method public void winningBidBid bids int numBids float minbid 0f    See Answer
Get Answers to Unlimited Questions

Join us to gain access to millions of questions and expert answers. Enjoy exclusive benefits tailored just for you!

Membership Benefits:
  • Unlimited Question Access with detailed Answers
  • Zin AI - 3 Million Words
  • 10 Dall-E 3 Images
  • 20 Plot Generations
  • Conversation with Dialogue Memory
  • No Ads, Ever!
  • Access to Our Best AI Platform: Flex AI - Your personal assistant for all your inquiries!
Become a Member

Other questions asked by students