Ex_3CH_7 - } public static int one(int x, int y) { int...

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

View Full Document Right Arrow Icon
import java.util.Scanner; import java.lang.*; import java.io.*; import java.text.*; import java.math.*; import java.text.DecimalFormat; import java.lang.String; // Jeremy Debruce // 2/18/2009 //Chapter 7 / public class Ex_3CH_7 { // Scanner static Scanner Console = new Scanner(System.in); public static void main(String[] args) { int num,x1,x2,y1,A; double dec, y2,B; System.out.println("Enter a value for x1."); x1= Console.nextInt(); System.out.println("Enter a value for y1."); y1= Console.nextInt(); A=one(x1,y1); System.out.println(A); System.out.println("Enter a value for x2."); x2= Console.nextInt(); System.out.println("Enter a Double for y2."); y2= Console.nextDouble(); B= two(x2,y2); System.out.println(B);
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: } public static int one(int x, int y) { int sum,sum1; System.out.println(" Please enter a value for x. "); x = Console.nextInt(); System.out.println(); System.out.println(" Please enter a value for y. "); y = Console.nextInt(); if (x > y) { sum = x+y; return (sum); } else sum1=(x-2)* y; return (sum1); } public static double two(int x, double a) { int first = one(6,8); double z; System.out.println(" Please enter a value for a. "); a = Console.nextDouble(); System.out.println(" Please enter a value for z. "); z = Console.nextDouble(); z z = z + a; first = first + x; f if (z > first*2) return z; else return 2*first-z; r } }...
View Full Document

This note was uploaded on 06/17/2011 for the course COMP 2302 taught by Professor Staff during the Spring '11 term at Kennesaw.

Page1 / 2

Ex_3CH_7 - } public static int one(int x, int y) { int...

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