coin - System.out.println("Enter your first

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package coin; import javax.swing.*; // For JFrame import java.awt.*; // For Color and Container import java.util.Scanner; import java.text.DecimalFormat; /** * * @author */ public class Main { /** * @param args the command line arguments */ public static void main(String[] args) { String name; double Total; int pennies, nickels; Scanner input = new Scanner(;
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: System.out.println("Enter your first name:"); name = input.nextLine(); System.out.println("Enter the number of Nickels:"); nickels = input.nextInt(); System.out.println("Enter the number of Pennies:"); pennies = input.nextInt(); System.out.println ("Good Work " +name); Total=nickels*.05+pennies*.01; DecimalFormat df1 = new DecimalFormat("###.00"); System.out.print("Your collection is worth $" + df1.format(Total)); } }...
View Full Document

This homework help was uploaded on 04/07/2008 for the course CSCI 161 taught by Professor Webster during the Spring '08 term at Millersville.

Ask a homework question - tutors are online