Question: For the given program, how many print statements will execute? public static void printShippingCharge ( double weight ) { if ( ( weight > 0

For the given program, how many print statements will execute?
public static void printShippingCharge(double weight){
if((weight >0.0) && (weight <=10.0)){
System.out.println(weight *0.75);
}
else if((weight >10.0) && (weight <=15.0)){
System.out.println(weight *0.85);
}
else if((weight >15.0) && (weight <=20.0)){
System.out.println(weight *0.95);
}
}
public static void main(String args[]){
printShippingCharge(18);
printShippingCharge(6);
printShippingCharge(25);
}
Group of answer choices
3
1
9
2

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 Databases Questions!