Question: For the given program, how many cout statements will execute? void PrintShippingCharge ( double itemWeight ) { if ( ( itemWeight > 0 . 0

For the given program, how many cout statements will execute?
void PrintShippingCharge(double itemWeight){
if ((itemWeight >0.0) && (itemWeight <=10.0)){
cout <<(itemWeight *0.75)<< endl;
}
else if ((itemWeight >10.0) && (itemWeight <=15.0)){
cout <<(itemWeight *0.85)<< endl;
}
else if ((itemWeight >15.0) && (itemWeight <=20.0)){
cout <<(itemWeight *0.95)<< endl;
}
}
int main(){
PrintShippingCharge(18);
PrintShippingCharge(6);
PrintShippingCharge(25);
return 0;
}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!