Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Postage calculation with negative weight error message. Improve the program by also outputting The next higher weight is ___ with a cost of ___ cents.

Postage calculation with negative weight error message.

Improve the program by also outputting "The next higher weight is ___ with a cost of ___ cents".

image text in transcribed

1 import java.util.scanner; 2 3 public class PostageCalc 4 public static void main (String [1 args) Scanner scnr new Scanner (System.in); final int NUM. ELEMENTS = 14; // Weights in ounces double [] letterwWeights 11.0, 2.0, 3.0, 3.5, 4.0, 5.0, 6.0 8 9 7.0, 8.e, 9.0, 10.0, 11.0, 12.0, 13.0; Costs in cents (usps.com 2017) int[] postageCosts 49, 70, 91, 112, 161, 182, 203, 224, 245, 266, 287, 308, 329, 350); 12 13 14 15 double userLetterweight; boolean foundWeight; int i; Prompt user to enter letter weight System.out.print("Enter letter weight (in ounces): "): userLetterweight scnr.nextDouble); 17 19 20 21 Postage costs is based on smallest letter weight greater than /1 or equal to mailing letter weight foundweight false; 23 24 25 26 27 28 29 30 for (i-0; (i

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Concepts

Authors: David Kroenke, David Auer, Scott Vandenberg, Robert Yoder

10th Edition

0137916787, 978-0137916788

More Books

Students also viewed these Databases questions

Question

Define marketing.

Answered: 1 week ago

Question

What are the traditional marketing concepts? Explain.

Answered: 1 week ago

Question

Define Conventional Marketing.

Answered: 1 week ago

Question

Define Synchro Marketing.

Answered: 1 week ago