Please write a java code using the JOptionPane class for input/output. Function read list_of_bids Pass In: nothing Initialise count = 0,bid_amount=0 Initialise two dimensional array list_of_bids[number of bids][2] while (count < 10) Read budget_amount from the user if budget_amount is not a number then Print error message "Invalid Input" continue Add bid and rating to list_of_bids Increment the value of count by 1
Please write a java code using the JOptionPane class for input/output.
Function read list_of_bids
Pass In: nothing
Initialise count = 0,bid_amount=0
Initialise two dimensional array list_of_bids[number of bids][2]
while (count < 10)
Read budget_amount from the user
if budget_amount is not a number then
Print error message "Invalid Input"
continue
Add bid and rating to list_of_bids
Increment the value of count by 1
end while
Pass Out: 2d array list_of_bids[number of bids][2]
Endfunction
Function calculating average
Pass In: 2d array list_of_bids[number of bids][2]
Initialise bids_array by extracting bids from the 2d array
Initalise average = 0,sum=0,count_of_bids=length of bids array
while bid in bids_array
sum=sum+bids
average=sum/count_of_bids
Pass Out : average
Endfunction
Function determine winning bid
Pass In: 2d array list_of_bids[number of bids][2], budget
Initialise bids_array by extracting bids from the 2d array passed,2d_budget_array to empty, rating to 5
Initalise array of winningbid
Initialise budget_bids_array to zero
while elements in bids_array
if element< budget
add element to budget_bids_array
sort the budget_bids_array
while element in budget_bids_array
find the corresponding rating
add the element and rating to 2d_budget_array
FOR element in 2d_budget_array
if elemnts rating==5
add to winningbid array
Pass Out : winningbid array
Endfunction
Function main
Pass In: Nothing
Print "Enter the budget"
Read budget from the user
Call: read list_of_bids
Call: calculating average
//may do the printing here or may call a method to print like above
Call: determine winning bid
print winning bid
Pass Out: value zero to the
Endfunction

Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 3 images









