Question

Need help with this program in C #CheckZips.cs Instructions sing static System.Console 2 class Checkzips Write a program named CheckZips that is used by a package delivery service to check delivery areas. Information Review Mode Project Help Download Share static void Main) string[] zips {12789, 54012, 54481, 54982, The program contains an array that holds the 10 zip codes of areas to which the company makes deliveries. (Note that this array is created for you and does not need to be changed.) 60007 Theme 60103,60187, 60188, 71244, 9021 0; // Write your main here Light 9 10 图Keymap Prompt a user to enter a zip code, and display a message indicating whether the zip code is in the companys delivery area Default For example if the user enters a zip code in the array, such as 60007, the output should be Delivery to 60007 ok A Danger Area Reset Project If the user enters a zip code not in the array, such as 60008, the output should be Sorry- no delivery to 60008

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Answer:


using System;
class HelloWorld {
static void Main() {
string[] zips = {"12789", "54812", "54481", "54982", "60007", "60103", "60187", "60188", "71244", "98210"};
int f =0;
Console.WriteLine("Enter a zip code:");
string zip = Console.ReadLine();
  
for (int i = 0; i < zips.Length; i++)
{
if(zips[i]==zip)
{
Console.WriteLine("Delivery to "+zip+" ok.");
f = 1;
}
}
  
if(f==0)
{
Console.WriteLine("Sorry - no delivery to "+zip+".");
}
  
}
}

Output:

Enter a zip code: 60007 Delivery to 60007 ok.

PLEASE UPVOTE IF YOU FOUND THIS HELPFUL!

Add a comment
Know the answer?
Add Answer to:
Need help with this program in C # CheckZips.cs Instructions sing static System.Console 2 class Checkzips...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Instructions CheckZips.cs + >_ Terminal Write a program named CheckZips that is used by a package...

    Instructions CheckZips.cs + >_ Terminal Write a program named CheckZips that is used by a package delivery service to check delivery areas. 1 using static System.Console; 2 class CheckZips 3 { 4 static void Main() 5 { 6 string[] zips = {"12789", "54012", "54481", "54982", "60007", "60103", "60187", "60188", "71244", "90210"}; CheckZips.cs(10,8): error CS002 9: Cannot implicitly convert ty pe 'string' to 'string[]' CheckZips.cs(18,5): error CS001 9: Operator '==' cannot be appl ied to operands of type 'string []' and...

  • C SHARP PROGRAM LANGUAGE The program below isn't working quite right. First compile and run it...

    C SHARP PROGRAM LANGUAGE The program below isn't working quite right. First compile and run it to familiarize yourself with the output. Then update the program to implement the following requirements: 1. the program shall sing ( display with WriteLine() ) the song's verses for drinks 100 through 91. 2. the program shall not sing the song's verses for drinks 90 - 7. 3. the program shall implement a string variable which is initialized by the programmer to the type...

  • Please help. I need a very simple code. For a CS 1 class. Write a program...

    Please help. I need a very simple code. For a CS 1 class. Write a program in Java and run it in BlueJ according to the following specifications: The program reads a text file with student records (first name, last name and grade). Then it prompts the user to enter a command, executes the command and loops. The commands are the following: "printall" - prints all student records (first name, last name, grade). "firstname name" - prints all students with...

  • In c++ Write a program that contains a class called Player. This class should contain two...

    In c++ Write a program that contains a class called Player. This class should contain two member variables: name, score. Here are the specifications: You should write get/set methods for all member variables. You should write a default constructor initializes the member variables to appropriate default values. Create an instance of Player in main. You should set the values on the instance and then print them out on the console. In Main Declare a variable that can hold a dynamcially...

  • I need help with the C++ for the following problem: Write a program that can store...

    I need help with the C++ for the following problem: Write a program that can store and output 5 integers, where the user can input its value into an array named arrayValue. The program should implement the following: 1. Calculate the sum and average of the array. 2. Output the content (value) that stored in the array of five elements. 3. Continue to ask the user to store for storing data into another array.

  • Need help answering the following using java 2a. Write a java program (just a “void main”)...

    Need help answering the following using java 2a. Write a java program (just a “void main”) that will reverse the digits of a user entered, positive three-digit number. You can assume the user enters an integer. Your code segment should first verify that the user has entered a number from 100 to 999 (error message if not). If the user has entered a three-digit number, output a new number with the original digits reversed. 2b. Instead of being limited to...

  • Write a C++ program for the instructions below. Please read the instructions carefully and make sure...

    Write a C++ program for the instructions below. Please read the instructions carefully and make sure they are followed correctly.   please put comment with code! and please do not just copy other solutions. 1. write the code using function 2. Please try to implement a function after the main function and provide prototype before main function. Total Characters in String Array 10 points Problem 2 Declare a string array of size 5. Prompt the user enter five strings that are...

  • need help with c++ project: For the project. Create a c++ program about bus booking and...

    need help with c++ project: For the project. Create a c++ program about bus booking and ticketing system that - This system also needs you to key in your username and password precisely and ask again to confirm your booking of the bus ticket, and output of the ticket fully displayed -Must include selections, looping and functions, and array. - minimum of 6 functions including main function Keywords that should not be in the source code: class, struct, fstream, ifstream,...

  • Please Help *Urgent* 1 /* */ 2 public class LabFinal 3 { 4 public static void...

    Please Help *Urgent* 1 /* */ 2 public class LabFinal 3 { 4 public static void main(String[] args) { 5 String mesg = "Try out this String."; 6 char[] hold = mesg.toLowerCase().toCharArray(); 7 int p=0; 8 9 System.out.println(forwardSearch(hold,'s')); //output generated 11 10 System.out.println(forwardSearch(hold,'t')); //output generated 0 11 System.out.println(p=forwardSearch(hold,'t',2)); //output generated 6 12 System.out.println(p=forwardSearch(hold,'t',p+1)); //output generated 8 13 System.out.println(p=forwardSearch(hold,'z')); //output generated -1 14 System.out.println(backwardSearch(hold,'s')); //output generated 13 15 System.out.println(backwardSearch(hold,'t')); //output generated 14 16 System.out.println(p=backwardSearch(hold,'t',13)); //output generated 8 17 System.out.println(p=backwardSearch(hold,'t',p-1)); //output generated...

  • Need help figuring this out Write a program that reads in a sequence of numbers (doubles)...

    Need help figuring this out Write a program that reads in a sequence of numbers (doubles) from standard input until 0 is read, and stores them in an array, This part is done using iteration (loop). You may assume that the maximum size of the array will not be more than 100. Your program computes the maximum number stored in the array, the count of negative numbers, and computes the sum of positive numbers, using recursion. You need to have...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT