// setprice per item public void setPricePerItem ( double price ) { pricePerItem
ID: 3609645 • Letter: #
Question
// setprice per itempublic void setPricePerItem( double price )
{
pricePerItem = ( price <0.0) ? 0.0 :price; //validate price
} // endmethod setPricePerItem
Based off this post: computer-science-topic-5-504359-cpi0.aspx
The code above does not make senseto me. It seems like backwards thinking because to me it says ifthe price is less than zero set pricePerItem equal to price else ifprice is greater than zero, price is set to zero and pricePerItemis equal to price. Is my thinking wrong?
Explanation / Answer
please rate - thanks // setprice per item public void setPricePerItem( double price ){ pricePerItem = ( priceRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.