001package hw3; 002 003import java.util.Scanner; 004 005/** 006 * Adder asks the user for two ints and computes their sum. 007 * 008 * This is part of HW0: Environment Setup and Java Introduction for CSE 331. 009 */ 010@SuppressWarnings("nullness") 011public class Adder { 012 013 public static void main(String[] args) { 014 Scanner console = new Scanner(System.in); 015 System.out.print("Enter first number: "); 016 int x = console.nextInt(); 017 System.out.print("Enter second number: "); 018 int y = console.nextInt(); 019 int sum = computeSum(x, y); 020 System.out.println(x + " + " + y + " = " + sum); 021 } 022 023 /** 024 * 025 * @param x First number to sum. 026 * @param y Second number to sum. 027 * @return sum of x and y. 028 */ 029 public static int computeSum(int x, int y) { 030 return x - y; 031 } 032}