1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
horrorfan [7]
4 years ago
10

Write a program called DeliveryCharges for the package delivery service. The program should use an array that holds the 10 zip c

odes of areas to which the company makes deliveries. (Note that this array has been created for your and does not need to be changed.) A Parallel array has also been creating contating 10 delivery charges that differ for each zip code. Prompt a user to enter a zip code, and then display either a message indicating the price of delivery to that zip code or a message indicating that the company does not deliver to the requested zip code.
Computers and Technology
1 answer:
Vlad [161]4 years ago
8 0

Answer:

import java.util.Scanner;

public class DeliveryCharges

{

public static void main(String[] args) {

 

       String[] zips = {"01234", "11234", "21234", "31234", "41234", "51234", "61234", "71234", "81234", "91234"};

    double[] prices = {2.2, 1.0, 3.6, 6, 9, 7.1, 0.8, 4.7, 3.3, 5.2};

    int index = -1;

    Scanner ob = new Scanner(System.in);

    System.out.print("Enter the zip code for your delivery: ");

    String zip = ob.next();

   

    for (int i=0; i<10; i++) {

        if (zip.equals(zips[i])) {

            index = i;

        }

    }

       

    if (index!= -1)

       System.out.println("Delivery charge to " + zips[index] + " is: " + prices[index]);

    else

       System.out.println("No delivery to " + zip);

}

}

Explanation:

Initialize the zips and prices

Initialize index that represents the index of the zip code. If the entered zip code is in the array

Ask the user to enter the zip code

Create a for loop that iterates through the zips. If the entered zip is in the zips, set its index to index

When the loop is done, check if the index. If the index is not -1, that means zip code was found in the zips array, print the corresponding price from the price array. Otherwise, print no delivery for the entered zip code

You might be interested in
Which is used for making documentation file from microsoft office package​
ratelena [41]

Answer:

the word is use for making docs

5 0
3 years ago
Read 2 more answers
You are designing an ecommerce web application that will scale to hundreds of thousands of concurrent users. Which database tech
Elis [28]

Answer: Amazon DynamoDB

Explanation:

The database technology that is best suited to hold the session state in this example is the Amazon DynamoDB.

Amazon DynamoDB is a document database which helps in delivering high quality and fast cperformance at any scale. It can be used to scale to hundreds of thousands of concurrent users as it's multi-active, and has a durable database that has built-in security.

6 0
3 years ago
Question # 4
bezimeni [28]

Answer:

the last one I think not 100% sure

6 0
4 years ago
Name the technique used to separate the mixture of colours in black ink ​
Nitella [24]

Answer:

chromatography

hope it helps

6 0
3 years ago
Read 2 more answers
11)When, if ever, will the geometric average return exceed the arithmetic average return for a given set of returns?A) When the
grigory [225]

Answer: E. Never

geometric average return can NEVER exceed the arithmetic average return for a given set of returns

Explanation:

The arithmetic average return is always higher than the other average return measure called the geometric average return. The arithmetic return ignores the compounding effect and order of returns and it is misleading when the investment returns are volatile.

Arithmetic returns are the everyday calculation of the average. You take the series of returns (in this case, annual figures), add them up, and then divide the total by the number of returns in the series. Geometric returns (also called compound returns) involve slightly more complicated maths.

6 0
3 years ago
Other questions:
  • Zack is working on an assignment at school. He wants to save his work so he can take it home and complete it on his home compute
    13·1 answer
  • What happens to the data in rom when the power is turned off?
    10·1 answer
  • A group of students want to create an educational online game for computer laboratory in their school which type of network will
    6·1 answer
  • Which camera options shows time to be slowly
    5·1 answer
  • Leslie is looking for better job opportunities in his current career path. Which career planning guideline would help him as he
    6·2 answers
  • Explain 5 service provided by Internet​
    6·1 answer
  • What does it mean to say that a graph is complete?
    14·1 answer
  • First person to answer gets free brainlist
    15·2 answers
  • Anyone help me please​
    6·2 answers
  • Spreadsheets are sometimes credited with legitimizing the personal computer as a business tool. Why do you think they had such a
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!