Calculate the actual shipping cost

Assignment Help Computer Engineering
Reference no: EM132129014

The You Send It We Rend It Shipping Company charges the following shipping costs to ship packages:

Weight of Package (in pounds) Rate Per 100 miles (or partial 100 miles) shipped

From 1 lb up to and including 10 lbs $ 5.01 From 11 lbs up to and including 20 lbs $ 7.02 From 21 lbs up to and including 30 lbs $ 9.03 From 31 lbs up to and including 40 lbs $ 11.04 From 41 lbs up to and including 60 lbs $ 15.00

Write a program that asks for the weight of a package in pounds and then the distance the package is to be shipped. With this information, calculate and display the shipping charges for that package.

You may assume that all distances and weights will be integer values. You may not assume, however, that the values the user enters are valid. Because of this, your program will need to validate that the weight they enter is between 1 and 60, inclusive. The company can only ship packages between 1 pound and 60 pounds, inclusive (make sure that you allow for 1 and 60).

Once a valid weight has been obtained, your program will need to prompt the user for a valid distance until they enter a value greater than or equal to 1. The company has to ship a package at least 1 mile.

Output your results with two significant digits after the decimal place.

To calculate the shipping cost, figure the shipping rate based on the weight, then use the number of miles to calculate the actual shipping cost.

For example, for a package that weighs 22 pounds that is being shipped 297 miles, you should charge the individual $27.09 because: you should charge $9.03 (based on the weight) for the first 100 miles, $9.03 for the second 100 miles and another $9.03 for the remaining 97 miles, which is a fraction of 100 miles. Do not pro-rate the shipping charges based on partial mileage (like 97/100 miles).

-----------------------------------------------------------------------

This is what I have so far, I'm lost!

import java.util.Scanner;

public class psingh_Shipping
{
public static void main(String args[])
{
int weight = 0;
int distance;
Scanner in=new Scanner(System.in);

System.out.println("Welcome to the You Send It We Rend It Shipping Company");

System.out.print("How heavy is your package in pounds (1-60)? ");
weight=in.nextInt();

while(weight <= 0 || weight > 60)
{
System.out.print("How heavy is your package in pounds (1-60)? ");
weight=in.nextInt();
}

if(distance > 0)
{
System.out.print("%d\n", n);
distance=in.nextInt();uj
}

/*if(weight<11) price = distance*5.01;
else if (weight<21) price = distance*7.02;
else if (weight<31) price = distance*9.03;
else if (weight<41) price = distance*11.04;
else price = distance*15;

System.out.println("How far will you be shipping the package in miles? ");

System.out.println("Your total shipping cost for miles is tiny_mce_markerquot; + price);*/
}
}

Reference no: EM132129014

Questions Cloud

Will services follow the trend of manufacturing : Will services follow the trend of manufacturing in being outsourced and offshored from industrial countries to developing countries?
How would you measure the effect of the change : How would you measure the effect of the change? For example, consider the number of counselors used and the arrival pattern of students.
Discuss which design or interface you prefer and why : Compare the pros and cons of designing the application using the three different interfaces with respect to conducting group projects online.
What was the purpose of the software : You may choose one discussed in class or research one yourself. In your analysis, identify the following: What was the purpose of the software?
Calculate the actual shipping cost : To calculate the shipping cost, figure the shipping rate based on the weight, then use the number of miles to calculate the actual shipping cost.
Identify the security problems : What is a( IPSEC, SSL , VPN, DTLS , DMARC, PKI, PEM, SSH, Kerberos, DKIM) ?. Brifley and answer the following brief.
How would you handle this security incident : He tells you that the laptop has at least 20 cases with Social Security numbers of individuals he has been assisting.How would you handle this security incident
Statement using three ethical communication issues : Discuss this statement using three ethical communication issues as examples - The abstract, essay title, paragraph headings and/or sub-headings (if applicable)
Explored the Fundamentals of Health Promotion : In the assessment you have explored the Fundamentals of Health Promotion, Ethics and evidence, Health Promotion Practice

Reviews

Write a Review

Computer Engineering Questions & Answers

  What is the value shown by the bit string

What is the value shown by the bit string 101101 if - Negate the following binary numbers in 4-bit 2's complement representation - How large a value can be represented by each of the unsigned binary quantities?

  What are advantages and disadvantages of separate address

The 68000 implements negative addresses because the contents of address registers are treated as 2's-complement values. What is a negative address.

  What are the differences between sds and gon

What are the differences between SDs and GON? White a program in your favorite language corresponding to The decorated tree.

  Give the contents of the b-tree

Give the contents of the B-tree that results when the keys EA S YQUES T I O N are inserted in that order into an initially empty tree, with M = 5.

  Who are the players involved with the new internet-two

Who are the players involved with the new Internet2? What does it take to become one of these players?

  Program to generate professor rating class

Write down the program which generates a Professor Rating class containing of the professor ID and three ratings. The three ratings are utilized to evaluate the easiness, helpfulness, and clarity.

  Write a program to generate random complete weighted graphs

Write a program to generate random complete weighted graphs with V vertices by simply filling in an adjacency matrix with random numbers between I and V.

  D flip-flops

Using three D flip-flops,a multiplexer,decoders and gates, construct a 3-bit Gray code counter that has two inputs: reset, which sets the counter to 000, and inc, which makes the counter go to the next value in the sequence.

  Write function that will interchange left and right subtrees

Write a function that will interchange all left and right subtrees in a linked binary tree.

  How many private sections are required in a class

How many public: sections are required in a class for the class to be useful? How many private: sections are required in a class?

  Determine which version of the software should be used

Microsoft has released Windows Server 2008. As with Windows 2003, there are several versions of the server software. What are these versions, and what are the criteria that determine which version of the software should be used

  Show an example of the vulnerability of rsa

Show an example of the vulnerability of RSA to selective forgery when the values of p and q are small. Use p.= 19 and q = 3.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd