computers - Programming

posted by .

Create a program that uses two parallel one-dimensional arrays. The program displays a shipping charge that is based on the number of items ordered by a customer. The shipping charge scale is shown in Figure 1 below. Store the maximum order amounts in a one dimensional int array. Store the shipping charge amounts in a parallel one dimensional int array. The program should allow the user to enter the number of items a customer ordered. It then should display the appropriate shipping charge. Use a sentinel value to stop the program. Save and then run the program. Test the program appropriately.

Min.Order Max.Order ShippingCharge
1 10 15
11 50 10
51 100 5
101 99999 0

  • computers - Programming -

    Here's a little perl ditty that should do the trick. Adapt to the language of choice.

    my @max = (10,50,100,99999);
    my @sc = (15,10,5,0);

    do {
     print "enter amount ordered: ";
     my $amt = <>;
     last if $amt <= 0;
     printf "Order: %5d -- Shipping Charge: \$%d\n",$amt,pop grep($amt<$_,@sc);
    }

  • computers - Programming -

    my @max = (10,50,100,99999);
    my @sc = (15,10,5,0);

    do {
    print "enter amount ordered: ";
    my $amt = <>;
    last if $amt <= 0;
    printf "Order: %5d -- Shipping Charge: \$%d\n",$amt,pop grep($amt<$_,@sc);
    }

Respond to this Question

First Name
School Subject
Your Answer

Similar Questions

  1. Computer (Programming Logic and Design)

    How do i Create a program that determine the shipping cost for an order based on the following table: From To Price  $0.00 $19.00 $2.95  $20.00 $49.99 $3.95  $50.00 $74.99 $4.95  $75.00 $1000.00 $Free I don't understand how to …
  2. programming

    How do i Create a program that determine the shipping cost for an order based on the following table:  From To Price   $0.00 $19.00 $2.95   $20.00 $49.99 $3.95   $50.00 $74.99 $4.95   $75.00 $1000.00 $Free  I don't understand …
  3. Programming Logic

    Create a program that determine the shipping cost for an order based on the following table: From To Price $0.00 $19.99 $2.95 $20.00 $49.99 $3.95 $50.00 $79.99 $4.95 $75.00 $1000.00 Free
  4. Programming

    Create a program that determine the shipping cost for an order based on the following table: From $0.00 $20.00 $50.00 $75.00 To $19.99 $49.99 $79.99 $1000.00 Price $2.95 $3.95 $4.95 Free
  5. Shipping Cost Program (Raptor)

    Create a program that determine the shipping cpst for an order based on the follwoing table: From $0.00 $20.00 $50.00 $75.00 To $19.99 $49.99 $79.99 $1000.00 Price $2.95 $3.95 $4.95 Free
  6. C++ Programming

    I am so bad at programming and after this class I am done with it and changing my program! I don't even know where to start! It says demonstrate array of Struct,2 dimensional arrays and sorting routine. A trucking company charges the …
  7. Programming

    #include<stdio.h> int main() { char ch; printf("Enter Your State Name : "); scanf("%c",&ch); if(ch == 'a') printf("Shipping Charge : $25"); else if(ch == 'b') printf("Shipping Charge : $50"); else if(ch == 'c') printf("Shipping …
  8. Programming

    #include<stdio.h> int main() { char ch; printf("Enter Your State Name : "); scanf("%c",&ch); if(ch == 'a') printf("Shipping Charge : $25"); else if(ch == 'b') printf("Shipping Charge : $50"); else if(ch == 'c') printf("Shipping …
  9. Programming

    #include<stdio.h> int main() { char ch; printf("Enter Your State Name : "); scanf("%c",&ch); if(ch == 'a') printf("Shipping Charge : $25"); else if(ch == 'b') printf("Shipping Charge : $50"); else if(ch == 'c') printf("Shipping …
  10. C++ program

    #include<stdio.h> int main() { char ch; printf("Enter Your State Name : "); scanf("%c",&ch); if(ch == 'malacca') printf("Shipping Charge : $25"); else if(ch == 'pahang') printf("Shipping Charge : $50"); else if(ch == 'terengganu') …

More Similar Questions