Ask Me Help Desk

Ask Me Help Desk (https://www.askmehelpdesk.com/forum.php)
-   Other Programming (https://www.askmehelpdesk.com/forumdisplay.php?f=437)
-   -   I got stumped in my java coding (https://www.askmehelpdesk.com/showthread.php?t=786903)

  • Mar 15, 2014, 12:44 PM
    mnethery
    I got stumped in my java coding
    So my homework problem is : Make a Java program, ClockSolver, that determines all times during a twelve-hour day at which the two hands of a clock form a given angle.

    I already have the clock constructed but for the actual clocksolver this is what I have so far:
    public class ClockSolver {
    private int hours;
    private int minutes;
    private double seconds;
    static double hourHandSpeed = (360.0/(3600.0*12.0));
    static double minuteHandSpeed = ( 360.0/3600.0);
    static double clockTotatlSpeed = minuteHandSpeed - hourHandSpeed;
    static double find = 0;

    public static void main(String[] args) {
    double angle = Double.parseDouble(args[0]);
    double timeSlice = Double.parseDouble(args[1]);
    Clock C = new Clock (0,0,0.0,0.0);
    }
    public ClockSolver ( int hours, int minutes, double seconds ){
    if ( hours < 0 | hours > 12 | minutes < 0 | minutes > 60 | seconds < 0 | seconds > 60 ){
    throw new IllegalArgumentException();
    }
    else {
    this.hours = hours;
    this.minutes = minutes;
    this.seconds = seconds;
    }
    this.hours = 0;
    this.minutes = 0;
    this.seconds = 0.0;
    }
    public int getDegrees () {
    degrees = (hours*30 + (minutes/60) * 30) - (minutes * 6);
    }
    public int setDegrees () {
    if ( degrees = angle ) {
    return true;
    } else {
    return false;
    }
    }
    }

    Please help me figure out where I'm missing something

  • All times are GMT -7. The time now is 02:52 AM.