Question

***USING JAVA. MUST USE A SWITCH STATEMENT. THANK YOU.Fall 2019 - Homework #3: Shipping Rates A client has hired your firm to implement their shipping rate rules as a Java program

0 0
Add a comment Improve this question Transcribed image text
Answer #1
Thanks for the question.

Below is the code you will be needing  Let me know if you have any doubts or if you need anything to change.

Thank You !!

===========================================================================

import java.util.Scanner;

public class Shipping {

    public static void main(String[] args) {

        Scanner scanner = new Scanner(System.in);

        double height, width, length;
        System.out.print("Enter Height, Width, and Length as # # #: ");
        height = scanner.nextDouble();
        width = scanner.nextDouble();
        length = scanner.nextDouble();

        double weight;
        System.out.print("Enter package weight: ");
        weight = scanner.nextDouble();

        double distance;
        System.out.print("Enter distance: ");
        distance = scanner.nextDouble();

        int days = 0;
        double cost = 0.0;
        double volume = height * width * length;
        if (volume <= 0.5) cost += 5;
        else if (volume <= 2.0) cost += 10;
        else {
            cost += 20;
            days += 1;
        }

        if (weight <= 1.0) cost += 2;
        else if (weight <= 5.0) cost += 5;
        else if (weight <= 20) {
            cost += 10;
            days += 2;
        }

        if (distance <= 100.00) {
            cost += 5;
            days += 1;
        } else if (distance <= 1000.00) {
            cost += 15;
            days += 3;
        } else {
            cost += 25;
            days += 3;
        }

        System.out.printf("Package with volume %.2f cubic feet, weight of %.1f",volume,weight);
        System.out.printf(" and travels distance %.2f miles will cost $%.1f to ship, transit time: %d days",distance,cost,days);

    }
}

Shipping.java height = scanner.nextDouble (); width = scanner.nextDouble (); length scanner.next Double (); 13 14 15 16 doubl

Add a comment
Know the answer?
Add Answer to:
***USING JAVA. MUST USE A SWITCH STATEMENT. THANK YOU. Fall 2019 - Homework #3: Shipping Rates...
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
  • Python Language 3. Shipping Charges The Fast Freight Shipping Company charges the following rates (per 500...

    Python Language 3. Shipping Charges The Fast Freight Shipping Company charges the following rates (per 500 miles shipped): 1. Number Guessing Game Write a program for players to guess the number that the program randomly generated. Your program should randomly generate an integer between 1 and 10. After a player guessing a number, your program should display "Too small", "Too large", or "That's it!". Weight of Package (in Kilograms) 2 kg or less Over 2 kg but not more than...

  • The table below provides shipping rates for packages using UPS next day air or ground service...

    The table below provides shipping rates for packages using UPS next day air or ground service options. The rates vary according to both the weight of the package and the distance of the shipment (larger numbered zones are farther away). Note that the zone number also indicates the number of days required to deliver a package using ground service. For example, it would take three days and cost $7.40 to send a 10-pound package to zone 3 using ground service....

  • Use java programming for the following questions to have the solutions ready within today Jan 3...

    Use java programming for the following questions to have the solutions ready within today Jan 3 2020 at or before 7:00PM GMT+8 time zone: Question 13 Some service fees (% of asset amount) of two investment companies are shown in the following tables: Company A: Service Fee Type Fee Management Fee 1.5 Subscription Fee 5.0 Redemption Fee 1.0 Company B: Service Fee Type Fee Platform Fee 0.2 Management Fee 1.0 Subscription Fee 2.0 The above information is to be stored...

  • please post ONLY flatratepackage.cpp, flateratepackage.h, package inventory.h and package inventory.cpp... Thank you! In this homework, you...

    please post ONLY flatratepackage.cpp, flateratepackage.h, package inventory.h and package inventory.cpp... Thank you! In this homework, you are going to write a program to represent various types of packages offered by package-delivery services. You need to create an inheritance hierarchy to represent various types of packages with different shipping options and associated costs. The base class is Package and the derived classes are FlatRatePackage and OvernightPackage. The base class Package includes the following attributes: • Sender information: senderName (string), senderAddress (string),...

  • URGENT I have 3 hours for Submit this Homework so you can share yout codes with...

    URGENT I have 3 hours for Submit this Homework so you can share yout codes with me in 150mins Preliminary Notes: You have 4 hours to submit your solution. No late submission is accepted. Do not leave your submission to the last minute. You are not allowed to copy any code from anywhere. Your code will be checked by a software for similarity. Implement the code on your own and never share it with someone else. A test code is...

  • JAVA language CSE110 Principles of Programming Assignment 02.10 pts Assignment 02:100 pts CSE110 Principles of Programming...

    JAVA language CSE110 Principles of Programming Assignment 02.10 pts Assignment 02:100 pts CSE110 Principles of Programming Test #2 Given Inputs Length of road project (miles) : 3 Number of lanes Depth of asphalt (inches) 18 Days to complete project : 50 1. The trucks hauling asphalt have a maximum capacity of 5 US tons (10,000 lbs 2. The standard road lane is 12 feet wide. 3. Asphalt welghs 150 lbs per cubic foot 4. Asphalt costs $200 per ton 5....

  • Having trouble with the do while/while loop and the switch statement. I got some of the...

    Having trouble with the do while/while loop and the switch statement. I got some of the switch statement but cant get the program to repeat itself like it should.What i have so far for my code is below. Any help is appreciated... i am not sure what I am doing wrong or what i am missing. I am completely lost on the while loop and where and how to use it in this scenario. import java.util.Scanner; public class sampleforchegg {...

  • This is the question about object-oriend programming(java) please show the detail comment and prefect code of...

    This is the question about object-oriend programming(java) please show the detail comment and prefect code of each class, Thank you! This question contain 7 parts(questions) Question 1 Create a class a class Cat with the following UML diagram: (the "-" means private , "+" means public) +-----------------------------------+ | Cat | +-----------------------------------+ | - name: String | | - weight: double | +-----------------------------------+ | + Cat(String name, double weight) | | + getName(): String | | + getWeight(): double | |...

  • Problem 1: Financial Statement Ratio Analysis (40 points total) Use the following financial statements for Dell,...

    Problem 1: Financial Statement Ratio Analysis (40 points total) Use the following financial statements for Dell, Inc. to answer the questions which follow: BALANCE SHEET (SMil) 2017 10,298 2018 7,972 % 28.9 2019 9,092 % 34.3 40.2 Cash & Short Term Investments Accounts Receivable Inventory Other Current Assets Total Current Assets Net Fixed Assets Intangibles Other Long Term Assets Total Assets 6,152 24.0 660 2.6 2,829 11.3 19.939 76.6 2,409 8.7 0 0 3,287 14.7 25,635 100.0 7,693 27.9 1,180...

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
ADVERTISEMENT