Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

C++ Programming: Write an Else If Statement that prints out a message based on t

ID: 3768980 • Letter: C

Question

C++ Programming: Write an Else If Statement that prints out a message based on the following rules:

If the distance is

The shipping cost is

At least 1 but less than 100 miles

$5.00

At least 100 but less than 300 miles

$8.00

At least 300 but less than 600 miles

$10.00

At least 600 but less than 1000 miles

$12.00

If the distance is

The shipping cost is

At least 1 but less than 100 miles

$5.00

At least 100 but less than 300 miles

$8.00

At least 300 but less than 600 miles

$10.00

At least 600 but less than 1000 miles

$12.00

Explanation / Answer

#include<iostream.h>
#include<conio.h>

void main()
{
   int a;
   cout<<"Enter distance";
   cin>>a;
   cout<<"shipping cost=";
   if(a>=1 && a<100)
       cout<<"$5.00";
   else if(a>=100 && a<300)
       cout<<"$8.00";
   else if(a>=300 && a<600)
       cout<<"$10.00";
   else if(a>=600 && a<1000)
       cout<<"$12.00";

  
   getch();
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote