Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

import java.util.Scanner; /** The Fast Freight Shipping company charges the following rates: * * Weight of Package Rate per 500 Miles Shipped * * 2

import java.util.Scanner; /** The Fast Freight Shipping company charges the following rates: * * Weight of Package Rate per 500 Miles Shipped * * 2 pounds or less $1.10 * Over 2 pounds but not more than 6 pounds $2.20 * Over 6 pounds but not more than 10 pounds $3.70 * Over 10 pounds $3.80 * * The shipping charges per 500 miles are not prorated. For example, if a 2-pound package * is shipped 550 miles, the charge would be $2.20. Write a program that asks the user to enter * the weight of a package and then displays the shipping charges. */ public class ShippingCharges { public static void main (String[] args) { int weight; double distance = 0; double rate = 0; int distanceMultiplier = (int) distance / 500; int distanceReminder; Scanner input = new Scanner(System.in); System.out.println("Enter the weight of the package"); weight = input.nextInt(); System.out.println("The shipping distance"); distance = input.nextDouble(); distanceReminder = (int) distance % 500; if (distanceReminder == 0); if (rate ==(distanceMultiplier * 1.10)); else if (weight > 2 && rate == (distanceMultiplier * 2.20)); //rate = (distanceMultiplier * 2.10); //else if (weight > 2 && weight <=6); //rate = (distanceMultiplier * 2.20); else if (weight > 6 && rate == (distanceMultiplier * 3.70)); //rate = (distanceMultiplier * 3.70); else rate = (distanceMultiplier * 3.80); if (distanceReminder != 0) if (rate == (distanceMultiplier * 1.10)); else if (weight > 2 && rate == (distanceMultiplier * 2.20)); //rate = (distanceMultiplier * 1.10); // //else if (weight > 2 && weight <= 6) // rate = (distanceMultiplier * 2.20); else if (weight > 6 && rate == (distanceMultiplier * 3.70)); //rate = (distanceMultiplier * 3.70); else rate = (distanceMultiplier * 3.70); System.exit(0); } } need help. i run this program but the result show zero can someone help me what's wrong with my code

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

What is the most important part of any HCM Project Map and why?

Answered: 1 week ago