import java.util.Scanner; public class BarefootProgram { public static void main(String[] args) { int numKids, withSocks, withShoes, withBoth; Scanner keyboard = new Scanner(System.in); // Get the user input System.out.println("How many kids are there ? "); numKids = keyboard.nextInt(); System.out.println("How many are wearing socks ? "); withSocks = keyboard.nextInt(); System.out.println("How many are wearing shoes ? "); withShoes = keyboard.nextInt(); System.out.println("How many are wearing both shoes and socks ? "); withBoth = keyboard.nextInt(); // Now compute the answer int socksOnly = withSocks - withBoth; int shoesOnly = withShoes - withBoth; int barefoot = numKids - withBoth - socksOnly - shoesOnly; // Finally, display the results nicely System.out.println("There are " + barefoot + " barefoot kids."); } }