package test;

import java.awt.Graphics;
import java.awt.Image;

/**
 * Warning - this class is UNSYNCHRONIZED!
 */
public class RotatableImage {
    Image image;
    float currentDegrees;
float remainingDegrees;
    
    public void RotateableImage(Image image) {
        this.image = image;
        this.currentDegrees = 0.0f;
        this.remainingDegrees = 0.0f;
    }

    public void paintOn(Graphics g) {
        //put your code to rotate the image once in here, using current degrees as your rotation
    }

    public void spin(float additionalDegrees) {
        setSpin(currentDegrees + additionalDegrees);
    }

    public void setSpin(float newDegrees) {
        currentDegrees += newDegrees;
        while(currentDegrees < 0f) currentDegrees += 360f;
        while(currentDegrees >= 360f) currentDegrees -= 360f;
    }

}

