ApexSensei

Drills Apex basics

Pick the shipping fee

else if adds another test after an if.

Your task

Use if, else if and else to set shippingFee from orderTotal.

Integer orderTotal = 75;
Integer shippingFee;
String companyName = 'RidgePoint Capital';
Boolean reviewed = false;

Requirements

  1. The first test should be if (orderTotal >= 100) {
  2. The next test should be else if (orderTotal >= 50) {
  3. The last branch should be else {
  4. orderTotal should be 75

Sign in to open this drill