MorphingFun - Morphs one picture to...

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

View Full Document Right Arrow Icon
/* * * * Morphs one picture to another, based on user input. */ import*; i public class MorphingFun { public static void main(String[] args) { int tries = 0; boolean picturesValid = false; Picture startPic = null; Picture endPic = null; int intermediateSteps = -1; // while we still have tries left and while height/width are invalid. .. while(picturesValid == false) { tries++; // Read in the starting/ending filenames String startPictureFile = SimpleInput.getString("Enter the starting picture's filename"); String endPictureFile = SimpleInput.getString("Enter the ending picture's filename"); // Load the pictures startPic = new Picture(startPictureFile); endPic = new Picture(endPictureFile); // Are they not the same width/height? if(startPic.getWidth() != endPic.getWidth() || startPic.getHeight() != endPic.getHeight()) { e // Bad dimensions // see if the user exhausted their tries or not if(tries == 3) { SimpleOutput.showError("Three unsuccessful tries; program will
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 2

MorphingFun - Morphs one picture to...

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