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);*/
}
}
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
|