Hw1_sol - public class ChangeMaker public static void...

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

View Full Document Right Arrow Icon
Homework 1 is due on Thursday 9/1 at 11:30pm. This homework won't be not graded Learn submission of homework through Blackboard as an assignment. 1. Implement Welcome.java from the lecture notes and submit the Java file. //This program prints Welcome to Java! public class Welcome { public static void main(String[] args) { System.out.println("Welcome to Java!"); } } 2. Implement ChangeMaker.java from the lecture notes and submit the Java file. import java.util.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: public class ChangeMaker { public static void main(String args) { int change, rem, qs, ds, ns, ps; System.out.print("Input change amount (1-99): "); Scanner input = new Scanner(System.in); change = input.nextInt(); qs = change / 25; rem = change % 25; ds = rem / 10; rem = rem % 10; ns = rem / 5; rem = rem % 5; p s = r e m ; System.out.print(qs + " quarters," + ds + " dimes,"); System.out.println(ns + " nickels and" + ps + " pennies"); } }...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online