HW05 Solution2

HW05 Solution2 - counts[i] = counts[i] + userOrder }

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

View Full Document Right Arrow Icon
Sheet1 Page 1 // Solution to Homework #5, Problem #2 import java.util.Scanner public class HW5_2 { public static void main(String[] args) { String[] descriptions = {"Soy Burger", "Hamburger", "Cheeseburger", "Double Bypass Burger"} int[] counts counts = new int[descriptions.length] int userOrder Scanner scanner = new Scanner(System.in) for (int i = 0 userOrder = getInt("How many " + descriptions[i] + "s do you want? ")
Background image of page 1

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

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

Unformatted text preview: counts[i] = counts[i] + userOrder } System.out.println("\nYou ordered ") for (int i = 0 System.out.println(counts[i] + " " + descriptions[i] + "(s)") } } public static int getInt(String prompt) { System.out.print(prompt) Scanner scanner = new Scanner(System.in) return scanner.nextInt() } } Sheet1 Page 2 i < descriptions.length i++) { i < descriptions.length i++) {...
View Full Document

Page1 / 2

HW05 Solution2 - counts[i] = counts[i] + userOrder }

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