Deli - / / / / / / / / * DeliFormat.java Computes the price...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
// ********************************************************** // DeliFormat.java // // Computes the price of a deli item given the weight // (in ounces) and price per pound -- prints a label, // nicely formatted, for the item. // // ********************************************************** import java.util.Scanner; import java.text.DecimalFormat; import java.text.NumberFormat; public class Deli { // --------------------------------------------------- // main reads in the price per pound of a deli item // and number of ounces of a deli item then computes // the total price and prints a "label" for the item // -------------------------------------------------- public static void main (String[] args) { final double OUNCES_PER_POUND = 16.0; double pricePerPound; // price per pound double weightOunces; // weight in ounces double weight; // weight in pounds double totalPrice; // total price for the item Scanner scan = new Scanner (System.in); // Declare money as a NumberFormat object and use the
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 03/22/2010 for the course CS 202 taught by Professor Fong during the Spring '10 term at SIU Carbondale.

Page1 / 2

Deli - / / / / / / / / * DeliFormat.java Computes the price...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online