Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

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

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M93116479

Have any Question?


Related Questions in Computer Engineering

Each of the following lists has an average of 50 for which

Each of the following lists has an average of 50. For which one is the spread of the numbers around the average biggest?smallest? a. 0, 20, 40, 50, 60, 80, 100 b. 0, 48, 49, 50, 51, 52, 100 c. 0, 1, 2, 50, 98, 99, 100 Gu ...

Run sqlplus systemoracle11 and spool to ccis421bs6spooltxt

Run sqlplus system/Oracle11 and SPOOL to c:\cis421b\S6spool.txt User SCOTT, who had the password TIGER, changed it to something more secure, but has since forgotten it. If possible, demonstrate what you as a DBA can do t ...

Social sitessocial media is a common marketing tool and

Social Sites Social media is a common marketing tool and most site builders offer integration with major social media sites. Discuss at least two examples of what you would promote on social media from a web site that yo ...

Albert hoffmans wife has an ipod shuffle with five songs in

Albert Hoffman's wife has an iPod shuffle with five songs in her library: November Rain  by Guns 'N Roses Ain't No Mountain High Enough  by Nicholas Ashford and Valerie Simpson Call Me Maybe  by Carly Rae Jepsen Rainbow ...

Question multiple users access a specific computer on the

Question: Multiple users access a specific computer on the network in ABC Inc. The users use the computer to access a remote FTP server. The computer runs the Windows Server OS. The network administrator wants user-speci ...

Assume the following information for an imaginary closed

Assume the following information for an imaginary, closed economy. GDP = $100,000; taxes = $22,000; government purchases = $25,000; national saving = $15,000. Refer to Scenario 26-1.  For this economy, investment amounts ...

Software engineeringeach of the following heuristics helps

Software Engineering: Each of the following heuristics helps make a good module according to some modularity principle. Identify the principle for each letter. Modularity principles: Principle of Small Modules Principle ...

An array a1 n is said to have a majority element if more

An array A[1 . . . n] is said to have a majority element if more than half of its entries are the same. Given an array, the task is to design an efficient algorithm to tell whether the array has a majority element, and, ...

Sql statement neededcreate a table compatable with oracle

SQL STATEMENT NEEDED: Create a table (compatable with Oracle) to store the names of your friends' pets: -Any name -Mostly any structure -You must include a column that uniquely identifies each pet's owner -Add five+ pets ...

Question when a syscall is called which register must have

Question : When a syscall is called which register must have the syscall number? Which syscall is a must for every program? Why?

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As