Question
In the famous TV game show, The Price is Right, contestants are challenged to guess the price of an item presented for bid. The winner
In the famous TV game show, The Price is Right, contestants are challenged to guess the price of an item presented for bid. The winner of the bidding is the contestant who comes closest to the retail price of the item without going over. So if 5 contestants bid $42, $12, $50, $37 and $30 on an item whose correct price is $49, then the contestant who bid $42 would win even though $50 is closer to the actual price ($50 is over the retail price). As a second example, if 5 contestants bid $460, $410, $500, $440 and $1 on an item that retails for $400, then the contestant who bid $1 would win. Write an algorithm that given the unique bids of 5 contestants, B1, B2, B3, B4, B5 and the retail price, RP, of the item that they bid on will print out the winning bid.
Pleasee, help me write this algorithm.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started