Ask Experts Questions for FREE Help !
Ask
    mnethery's Avatar
    mnethery Posts: 1, Reputation: 1
    New Member
     
    #1

    Mar 15, 2014, 12:44 PM
    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

Check out some similar questions!

Java coding question [ 4 Answers ]

Suppose I have a text field in java (like in gmail home page you have username field ) So I want to fill that field automatically by taking record from the database so is there any mechanism in java to handle this problem??

I'm stumped [ 0 Answers ]

I have a intertherm heating and cooling unit in my mobile home the heater worked for about 2 days then just stopped the fan won't even come on unlessi turn it on manually at the furnace.. I changed the thermostat and still no change.. Please help

Java netbeans program- Connection between java and mysql,How to conn [ 0 Answers ]

which I wrote from a book but when I run it, it shows exception please give me the code to connect jlistbox to database when I click on btn1. btn coding should search "name" in database and shows all the names in listbox my coding: here-- r1,r2,r3 are radio btns and l1,l2,l3 are labels,...

Color coding on data line does not match jack color coding [ 1 Answers ]

Installing cat5 data standard blue/white-blue, green/white-green, orange/white-orange, and brown/white brown but the wall mount I purchased has black, yellow, white, green, blue, orange, brown, and green. What color line do I connect Where?

Color coding on line does not match jack color coding [ 11 Answers ]

The line going into the old phone jack has orange, green, blue and 3 white wires in it. Bought a new jack at Radio Shack and the colors of the wires in the replacement jack are red, green, black and yellow. Verizon repair was at best, snotty in telling me "we cannot tell you how to do repairs...


View more questions Search
 

Question Tools Search this Question
Search this Question:

Advanced Search

Add your answer here.