/* Desktop wallpapering program */ import java.util.Scanner; public class wallpaper { public static void main(String[] args) { Scanner kb = new Scanner(System.in); int screenWidth, screenHeight; double picWidth, picHeight; int ppi; long matArea; System.out.print("enter screen width and height in pixels: "); screenWidth = kb.nextInt(); screenHeight = kb.nextInt(); System.out.println("total screen area is " + screenWidth*screenHeight + " pixels"); System.out.print("enter picture width and height in inches: "); picWidth = kb.nextDouble(); picHeight = kb.nextDouble(); System.out.print("enter ppi: "); ppi = kb.nextInt(); picWidth = Math.ceil(picWidth * ppi); // convert from inches to pixels picHeight = Math.ceil(picHeight * ppi); // convert from inches to pixels System.out.println("picture width and height in pixels: " + picWidth + " " + picHeight); matArea = (long) (screenWidth*screenHeight - picWidth*picHeight); System.out.println("total mat area is " + matArea + " square pixels"); System.out.println("tiling will have " + (int) Math.ceil(screenHeight/picHeight) + " rows and " + (int) Math.ceil(screenWidth/picWidth) + " columns"); } }