Open Eclipse. Create a New  -> Java project.  Name it ParkersPackages  and click Finish and OK. Next, create a New -> Class.  Name it ParkersPackages and be sure to check the first checkbox under "Which method stubs would you like to create?" and click Finish. Delete the green comment text in the file "ParkersPackages.java" Add a comment at the top // (your name) Add another comment at the top // Project 3 Add code to the file "ParkersPackages.java" to create a program that will compute how much it will cost to ship a package based on the package weight and number of miles to the destination.  The details of the shipping costs are provided in the table below.  Your program should ask the user to enter the weight of the package and store it as a double. Next, your program should ask the user to enter the distance to the destination and store it as an integer.  Valid package weights are 1.0 - 50.0 pounds and valid shipping distances are 1 - 3000 miles, so if the weight is not between 1.0 - 50.0 pounds or the distance is not between 1 - 3000 miles, your program should print a message: "Sorry, you have entered invalid data - program terminated", else, your program should determine the costPer200Miles according to the table below. Then, your program should use this value to calculate the cost to ship the package the desired distance.                         *Requirement 1:  Use an if-else statement to check for invalid input and an if-else-if statement to determine the costPer200Miles.                         *Requirement 2:  If the distance goes over 200 miles (even by 1 mile), the customer is charged for another 200 miles (see sample output below)                        *Requirement 3:  Use the printf statement to format your monetary values to 2 decimal places. (see Chapter 3 for help as needed)                        *Requirement 4: Test your program with both valid and invalid input.                    *Hint: Use the division & modulus operators in your calculations to determine how much to charge for shipping.                   *Check your code against the checklist before submission  Weight Cost per 200 miles up to 5.0 pounds $10.00 up to 10.0 pounds $20.00 up to 15.0 pounds $30.00 up to 20.0 pounds $40.00 up to 30.0 pounds $50.00 up to 40.0 pounds $60.00 up to 50.0 pounds $70.00   Here are 4 individual sample runs of what your program output should look like:                                                                               ******Welcome to ParkersPackages****** ***We are a low-cost, secure shipping company that ships packages that weigh up to 50 pounds for up to 3000 miles***   Enter the weight of the package (1.0 - 50.0 pounds):  60.0 Enter the distance to the destination (1 - 3000 miles): 2000                        Sorry, you have entered invalid data - program terminated                                                                               ******Welcome to ParkersPackages****** ***We are a low-cost, secure shipping company that ships packages that weigh up to 50 pounds for up to 3000 miles***   Enter the weight of the package (1.0 - 50.0 pounds):  40.0 Enter the distance to the destination (1 - 3000 miles): 3001                        Sorry, you have entered invalid data - program terminated                                                                               ******Welcome to ParkersPackages****** ***We are a low-cost, secure shipping company that ships packages that weigh up to 50 pounds for up to 3000 miles***   Enter the weight of the package (1.0 - 50.0 pounds):  10.0 Enter the distance to the destination (1 - 3000 miles): 1000 The cost to ship this package is:  $100.00                                                                               ******Welcome to ParkersPackages****** ***We are a low-cost, secure shipping company that ships packages that weigh up to 50 pounds for up to 3000 miles***   Enter the weight of the package (1.0 - 50.0 pounds):  20.0 Enter the distance to the destination (1 - 3000 miles): 1001  *goes over, so charge for another 200 miles The cost to ship this package is:  $240.00

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
      1. Open Eclipse.
      2. Create a New  -> Java project.  Name it ParkersPackages  and click Finish and OK.
      3. Next, create a New -> Class.  Name it ParkersPackages and be sure to check the first checkbox under "Which method stubs would you like to create?" and click Finish.
      4. Delete the green comment text in the file "ParkersPackages.java"
      5. Add a comment at the top // (your name)
      6. Add another comment at the top // Project 3
      7. Add code to the file "ParkersPackages.java" to create a program that will compute how much it will cost to ship a package based on the package weight and number of miles to the destination.  The details of the shipping costs are provided in the table below.  Your program should ask the user to enter the weight of the package and store it as a double. Next, your program should ask the user to enter the distance to the destination and store it as an integer
      8. Valid package weights are 1.0 - 50.0 pounds and valid shipping distances are 1 - 3000 miles, so if the weight is not between 1.0 - 50.0 pounds or the distance is not between 1 - 3000 miles, your program should print a message: "Sorry, you have entered invalid data - program terminated"else, your program should determine the costPer200Miles according to the table below. Then, your program should use this value to calculate the cost to ship the package the desired distance. 

                       *Requirement 1:  Use an if-else statement to check for invalid input and an if-else-if statement to determine the costPer200Miles. 
                       *Requirement 2:  If the distance goes over 200 miles (even by 1 mile), the customer is charged for another 200 miles (see sample output below)
                       *Requirement 3:  Use the printf statement to format your monetary values to 2 decimal places. (see Chapter 3 for help as needed)
                       *Requirement 4: Test your program with both valid and invalid input. 

                  *Hint: Use the division & modulus operators in your calculations to determine how much to charge for shipping.
                  *Check your code against the checklist before submission 

Weight Cost per 200 miles
up to 5.0 pounds $10.00
up to 10.0 pounds $20.00
up to 15.0 pounds $30.00
up to 20.0 pounds $40.00
up to 30.0 pounds $50.00
up to 40.0 pounds $60.00
up to 50.0 pounds $70.00

 


Here are 4 individual sample runs of what your program output should look like:

 

 

                                                                          ******Welcome to ParkersPackages******

***We are a low-cost, secure shipping company that ships packages that weigh up to 50 pounds for up to 3000 miles***

 

Enter the weight of the package (1.0 - 50.0 pounds):  60.0

Enter the distance to the destination (1 - 3000 miles): 2000

                       Sorry, you have entered invalid data - program terminated

 

 

                                                                          ******Welcome to ParkersPackages******

***We are a low-cost, secure shipping company that ships packages that weigh up to 50 pounds for up to 3000 miles***

 

Enter the weight of the package (1.0 - 50.0 pounds):  40.0

Enter the distance to the destination (1 - 3000 miles): 3001

                       Sorry, you have entered invalid data - program terminated

 

 

                                                                          ******Welcome to ParkersPackages******

***We are a low-cost, secure shipping company that ships packages that weigh up to 50 pounds for up to 3000 miles***

 

Enter the weight of the package (1.0 - 50.0 pounds):  10.0

Enter the distance to the destination (1 - 3000 miles): 1000

The cost to ship this package is:  $100.00

 

 

                                                                          ******Welcome to ParkersPackages******

***We are a low-cost, secure shipping company that ships packages that weigh up to 50 pounds for up to 3000 miles***

 

Enter the weight of the package (1.0 - 50.0 pounds):  20.0

Enter the distance to the destination (1 - 3000 miles): 1001  *goes over, so charge for another 200 miles

The cost to ship this package is:  $240.00

Now follow the instructions below to create a new program named ParkersPackages:
1. Open Eclipse.
2. Create a New -> Java project. Name it Parkers Packages and click Finish and OK.
3. Next, create a New -> Class. Name it ParkersPackages and be sure to check the first checkbox under "Which method
stubs would you like to create?" and click Finish.
4. Delete the green comment text in the file "ParkersPackages.java"
5. Add a comment at the top // (your name)
6. Add another comment at the top // Project 3
7. Add code to the file "ParkersPackages.java" to create a program that will compute how much it will cost to ship a
package based on the package weight and number of miles to the destination. The details of the shipping costs are
provided in the table below. Your program should ask the user to enter the weight of the package and store it as a
double. ext, your program should ask the to enter the distance to the destination and store it as an integer.
8. Valid package weights are 1.0 - 50.0 pounds and valid shipping distances are 1 - 3000 miles, so if the weight is not
between 1.0 - 50.0 pounds or the distance is not between 1 - 3000 miles, your program should print a message: "Sorry,
you have entered invalid data - program terminated", else, your program should determine the costPer200Miles
according to the table below. Then, your program should use this value to calculate the cost to ship the package the
desired distance.
*Requirement 1: Use an if-else statement to check for invalid input and an if-else-if statement to determine the
*Requirement 2: If the distance goes over 200 miles (even by 1 mile), the customer is charged for another 200 miles
(see sample output below)
*Requirement 3: Use the printf statement to format your monetary values to 2 decimal places. (see Chapter 3 for help
*Requirement 4: Test your program with both valid and invalid input.
*Hint: Use the division & modulus operators in your calculations to determine how much to charge for
*Check your code against the checklist before submission
Weight
Cost per 200 miles
up to 5.0 pounds
up to 10.0 pounds
up to 15.0 pounds
up to 20.0 pounds
costPer200Miles.
as needed)
shipping.
$10.00
$20.00
$30.00
$40.00
Transcribed Image Text:Now follow the instructions below to create a new program named ParkersPackages: 1. Open Eclipse. 2. Create a New -> Java project. Name it Parkers Packages and click Finish and OK. 3. Next, create a New -> Class. Name it ParkersPackages and be sure to check the first checkbox under "Which method stubs would you like to create?" and click Finish. 4. Delete the green comment text in the file "ParkersPackages.java" 5. Add a comment at the top // (your name) 6. Add another comment at the top // Project 3 7. Add code to the file "ParkersPackages.java" to create a program that will compute how much it will cost to ship a package based on the package weight and number of miles to the destination. The details of the shipping costs are provided in the table below. Your program should ask the user to enter the weight of the package and store it as a double. ext, your program should ask the to enter the distance to the destination and store it as an integer. 8. Valid package weights are 1.0 - 50.0 pounds and valid shipping distances are 1 - 3000 miles, so if the weight is not between 1.0 - 50.0 pounds or the distance is not between 1 - 3000 miles, your program should print a message: "Sorry, you have entered invalid data - program terminated", else, your program should determine the costPer200Miles according to the table below. Then, your program should use this value to calculate the cost to ship the package the desired distance. *Requirement 1: Use an if-else statement to check for invalid input and an if-else-if statement to determine the *Requirement 2: If the distance goes over 200 miles (even by 1 mile), the customer is charged for another 200 miles (see sample output below) *Requirement 3: Use the printf statement to format your monetary values to 2 decimal places. (see Chapter 3 for help *Requirement 4: Test your program with both valid and invalid input. *Hint: Use the division & modulus operators in your calculations to determine how much to charge for *Check your code against the checklist before submission Weight Cost per 200 miles up to 5.0 pounds up to 10.0 pounds up to 15.0 pounds up to 20.0 pounds costPer200Miles. as needed) shipping. $10.00 $20.00 $30.00 $40.00
up to 5.0 pounds
up to 10.0 pounds
up to 15.0 pounds
up to 20.0 pounds
up to 30.0 pounds
up to 40.0 pounds
up to 50.0 pounds
Enter the weight of the package (1.0 - 50.0 pounds): 60.0
Enter the distance to the destination (1 - 3000 miles): 2000
Sorry, you have entered invalid data - program terminated
$10.00
$20.00
Enter the weight of the package (1.0 - 50.0 pounds): 40.0
Enter the distance to the destination (1 - 3000 miles): 3001
Sorry, you have entered invalid data - program terminated
$30.00
$40.00
Enter the weight of the package (1.0 - 50.0 pounds): 10.0
Enter the distance to the destination (1 - 3000 miles): 1000
The cost to ship this package is: $100.00
$50.00
Here are 4 individual sample runs of what your program output should look like:
$60.00
******Welcome to Parkers Packages******
***We are a low-cost, secure shipping company that ships packages that weigh up to 50 pounds for up to 3000
miles***
$70.00
******Welcome to Parkers Packages******
***We are a low-cost, secure shipping company that ships packages that weigh up to 50 pounds for up to 3000
miles***
******Welcome to Parkers Packages******
***We are a low-cost, secure shipping company that ships packages that weigh up to 50 pounds for up to 3000
miles***
******Welcome to Parkers Packages******
***We are a low-cost, secure shipping company that ships packages that weigh up to 50 pounds for up to 3000
miles***
Enter the weight of the package (1.0 - 50.0 pounds): 20.0
Enter the distance to the destination (1 - 3000 miles): 1001 *goes over, so charge for another 200 miles
The cost to ship this package is: $240.00
Transcribed Image Text:up to 5.0 pounds up to 10.0 pounds up to 15.0 pounds up to 20.0 pounds up to 30.0 pounds up to 40.0 pounds up to 50.0 pounds Enter the weight of the package (1.0 - 50.0 pounds): 60.0 Enter the distance to the destination (1 - 3000 miles): 2000 Sorry, you have entered invalid data - program terminated $10.00 $20.00 Enter the weight of the package (1.0 - 50.0 pounds): 40.0 Enter the distance to the destination (1 - 3000 miles): 3001 Sorry, you have entered invalid data - program terminated $30.00 $40.00 Enter the weight of the package (1.0 - 50.0 pounds): 10.0 Enter the distance to the destination (1 - 3000 miles): 1000 The cost to ship this package is: $100.00 $50.00 Here are 4 individual sample runs of what your program output should look like: $60.00 ******Welcome to Parkers Packages****** ***We are a low-cost, secure shipping company that ships packages that weigh up to 50 pounds for up to 3000 miles*** $70.00 ******Welcome to Parkers Packages****** ***We are a low-cost, secure shipping company that ships packages that weigh up to 50 pounds for up to 3000 miles*** ******Welcome to Parkers Packages****** ***We are a low-cost, secure shipping company that ships packages that weigh up to 50 pounds for up to 3000 miles*** ******Welcome to Parkers Packages****** ***We are a low-cost, secure shipping company that ships packages that weigh up to 50 pounds for up to 3000 miles*** Enter the weight of the package (1.0 - 50.0 pounds): 20.0 Enter the distance to the destination (1 - 3000 miles): 1001 *goes over, so charge for another 200 miles The cost to ship this package is: $240.00
Expert Solution
Algorithm
  1. Display a welcome message to the user.
  2. Prompt the user to enter the weight of the package.
  3. Validate the weight of the package. If the weight is not between 1.0 and 50.0 pounds, display an error message and terminate the program.
  4. Prompt the user to enter the distance to the destination.
  5. Validate the distance. If the distance is not between 1 and 3000 miles, display an error message and terminate the program.
  6. Determine the cost per 200 miles based on the weight of the package using an if-else-if statement.
  7. Calculate the cost to ship the package to the desired distance, accounting for additional 200-mile increments.
  8. Display the total cost to the user, formatted with two decimal places.
  9. End the program.
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 3 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY