HW04 Solution1

HW04 Solution1 - } public static double getDouble(String...

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

View Full Document Right Arrow Icon
Sheet1 Page 1 import java.util.Scanner public class HW4_1 { public static void main(String args[]) { double a, b // Inputs double y // Result a = getDouble("Enter value for a: ") b = getDouble("Enter value for b: ") y = sum(a, b) System.out.println("The sum is " + y + ".")
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 static double getDouble(String prompt) { System.out.print(prompt) Scanner scanner = new Scanner(System.in) return scanner.nextDouble() } public static double sum(double a, double b) { return a + b } }...
View Full Document

This note was uploaded on 04/10/2008 for the course ENGR 131 taught by Professor Xiaowei during the Spring '07 term at Case Western.

Ask a homework question - tutors are online