Sorry we dont deliver package to this location OR using System namespace

Sorry we dont deliver package to this location or

This preview shows page 2 - 4 out of 4 pages.

" Sorry we dont deliver package to this location" ); } } } } OR using System; namespace Package_Delivery_Part01 { class Program { static void Main( string [] args) { string zipCode = "" ; string [] zipcodes = { "77001" , "77002" , "77003" , "77004" , "77005" , "77006" , "77007" , "77008" , "77009" , "77010" }; bool zipValid = false ; //ask user to enter zip code Console .Write( "Please enter the destination zip code: " ); //get zip code entered by user zipCode = Console .ReadLine(); for ( int x = 0; x < zipcodes.Length; ++x) { if (zipCode == zipcodes[x]) { zipValid = true ; break ; } } if (zipValid) { Console .Write( "Valid zip" ); } else { Console .Write( "Invalid zip" ); } Console .ReadLine(); }
Image of page 2
} } CH.5 #5 using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Package_Delivery_Part02 { class Program { static void Main( string [] args) { string zipCode = "" ; string [] zipcodes = { "77001" , "77002" , "77003" , "77004" , "77005" , "77006" , "77007" , "77008" , "77009" , "77010" }; string [] deliveryCharges = { "230" , "145" , "320" , "66" , "213" , "98" , "253" , "222" , "423" , "30" }; int temp = 0; bool zipValid = false ; //ask user to enter zip code Console .Write( "Please enter the destination zip code: " ); //get zip code entered by user zipCode = Console .ReadLine(); for ( int x = 0; x < zipcodes.Length; ++x) { if (zipCode == zipcodes[x]) { zipValid = true ; temp = x; break ; } } if (zipValid) { Console .Write( "$" + deliveryCharges[temp]); } else { Console .Write( "The company does not deliver to the requested zip code" ); } Console .ReadLine(); } } } CH.5 #6
Image of page 3
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Package_Delivery_Part03 { class Program { static void Main() { int [] areaCode = new int [] { 262, 414, 608, 715, 815, 920 }; double [] perMinuteRate = new double [] { 0.07, 0.10, 0.05, 0.16, 0.24, 0.14 }; string
Image of page 4

You've reached the end of your free preview.

Want to read all 4 pages?

  • Spring '10
  • NEWBY
  • static void Main

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

Stuck? We have tutors online 24/7 who can help you get unstuck.
A+ icon
Ask Expert Tutors You can ask You can ask You can ask (will expire )
Answers in as fast as 15 minutes