Question: What is the best way to code this using Java. here is mine, but I cant figure out the for statement import java.util.Scanner; public class
What is the best way to code this using Java.
here is mine, but I cant figure out the for statement
import java.util.Scanner;
public class Delivery {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int [] zips = {
12789, 54012, 54481,
54982, 60007, 60103,
60187, 60188, 71244, 90210
};
double [] prices = {
2.40, 3.00, 3.50, 4.00,
4.50, 5.00, 5.25,
5.75, 6.10, 10.00
};
System.out.println("Delivery Charge");
System.out.println("Enter a Zip Code for delivery");
int zip = sc.nextInt();
double price = 0;
boolean isFound = false;
for (int i = 0;
if (zip [1] == zip)
}
System.out.println("Delivery charge is: " + prices);
Delivery Zip Code Delivery Write a program for a package delivery service. The program contains an array, named zips, that holds ten zip codes to which the company delivers packages. Here are the 10 zip codes: 12789, 54012, 54481, 54982, 60007, 60103, 60187, 60188, 71244, 90210. Also, the program contains a parallel array, named price, that holds ten delivery charges that differ for each zip code. The delivery charges are: 2.40, 3.00, 3.50, 4.00, 4.50, 5.00, 5.25, 5.75, 6.10, 10.00. Prompt a user to enter a zip code and 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 The output of your program should look and function like the examples shown below. Delivery Charge Enter a IP code for deliveryi 1278 Delivery charge ia 2. Delivery charge Eater a IIP code for delivery Sorrys no delivery to 37204
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
