Need major help please?

hello, i made the class and i believe its right.. well i thought it was right but wheni test the methods in my main it does not output what it should. for example if the time is 13 o clock it should go to one o clock. i think the problem is either in my class or im not testing it right. please help.
CLASS=
public class Clock
     //private data
    private int hours;
    private int minutes;
    private int seconds;
    //constructors
    public Clock()
        hours = 0;
        minutes = 0;
        seconds = 0;
    public Clock (int h, int m, int s)
        hours = h;
        minutes = m;
        seconds = s;
    //accessor methods
    public int getHours()
        return hours;
    public int getMinutes()
        return minutes;
    public int getSeconds()
        return seconds;
    //methods
    public String toString()
        String str;
        str = hours + " : " + minutes + " : " +seconds;
        return str;
    public void addHours(int h)
         if ((h > 0 ) && (h <= 12))
              hours = h;
         else
              hours = 0;
    public void addMinutes(int m)
         if ((m > 0 ) && (m <= 59))
              minutes = m;
         else
              minutes = 0;
    public void addSeconds(int s)
         if ((s > 0 ) && (s <= 59))
              seconds = s;
         else
              seconds = 0;
    public void setTime(int h, int m, int s)
         hours = h;   
         minutes = m;
         seconds = s; 
}MAIN=
// import statements
import javax.swing.*;
public class Clockclass
     public static void main(String args[])
     Clock noon = new Clock (11, 25, 54);
     Clock noclock = new Clock ();
     Clock morning = new Clock(5, 15, 36);
     Clock night = new Clock(7, 12, 15);
     System.out.println( noclock );
     System.out.println( noon );
     System.out.println(noon.getHours());
     System.out.println(noon.getMinutes());
     System.out.println(noon.getSeconds());
     System.out.println("noon time is: " + noon.toString());
     System.out.println(night);
     night.addHours(6);
     System.out.println(night);
     noclock.setTime(11,30,45);
     System.out.println( noclock );
     System.exit(0);
}

i add it in my to String
    //methods
    public String toString()
        String str; 
        String h1=" ",m1=" ",s1=" ";
        if (hours < 10)
             h1="0";
        else
             h1="";
        if (minutes < 10)
             m1= "0";
          else
               m1 = "";
          if (seconds < 10)
               s1 = "0";
          else
               s1 = " ";
        str = h1 + hours + " : " + m1 + minutes + " : " + s1 +seconds;
        return str;
    }

Similar Messages

  • Hardware or Software? Need Major Help Please

    Please help. I have a list of questions about my newly purchased I mac g5 complete with the i sight
    1) The dashboard likes to cause a lot of problems. It freezes on me but everything else is still running. I cant get out of the dash board. Its stuck. Ive deletd all the widgits ive downloaded but it still gets stuck.
    2) My mac consistantly freezes when am using an application. It just freezes so I run the hardware check with the CD liek it says to do in the manual. and then THAT frezes on me too. It was 90% done checking my hard drive for damages or what not and thn it froze. It started to change the scren to a bunch of diffrent colours. this went on for 15 minutes before it finally returned to the hardware check menu. And when it finally does the mouse doesnt move and its stuck.
    Please if anyone knows what to do about this help me.

    Welcome to Apple Discussions
    You may have defective RAM or other internal problems. Since you just purchased the machine you can return it to Apple within 14 days of purchase for either a new machine or refund. Contact them at once. These machines are designed to be fully functional out of the box. Infrequently, a defective machine can be produced.
    Also encourage you to purchase as much additional RAM as possible from a reputable 3rd party source, such as MacRam Direct or Crucial.
    Good Luck

  • Need Major help please - mac won't get passed apple screen

    Please help I have an assignment due in midnight tonight and my mac has just crashed. When I switch it on it loads the screen with the apple icon on it and with the animated turning circle but that's it. It doesn't do anything from there. Please give any advice you can.

    No I don't have a backup at all since my external HD broke. I can go into the leopard install setup with the disc. I have tried repairing disc with disk utility which it says is successful. It then still won't work. On trying to repair disc permissions it comes up with an error 'First Aid Failed - the underlying task reported failure on exit' comes up. During repairing disk it comes up with the error Incorrect block count for the file pcscd.pub.
    Thanks I appreciate your help.

  • Remote App on iPad connects but drops after about  20 mins. Need to turn  off wait about 1 minute then turn on wifi on iMac before it can reconnect. Need some help please.

    Remote App on iPad connects but drops after about  20 mins. Need to turn  off wait about 1 minute, then turn on wifi on iMac before it can reconnect. Need some help please.
    Already gone through troubleshooting guide a zillion times. Thanks.

    This worked for me... A little time consuming but once you get rolling it goes GREAT... Thanks....
    I got my artwork and saved it to my Desktop
    Opened up Microsoft Paint and clicked on "File" and "Open" and found it to get it on the screen to resize it
    Clicked "resize" and a box for changing it opened up
    Checked the box "Pixels" and "Unchecked maintain aspect ratio"
    Set Horizontal for 640 and Vertical for 480
    Clicked on "OK" and went back to "File" and did a "Save As" and chose JPEG Picture
    It came up "File Already Existed" and clicked "OK" (really did not care about the original artwork I found because wrong size)
    Went to iTunes and on the movie right clicked on "Get Info", clicked on "Details", then "Artwork"
    Go to the little box on the top left that shows your old artwork and click on it to get the little blue border to appear around it and hit "Delete" to make it gone
    Click on "Add Artwork" and find it where you put the one from above on your Desktop and hit "Open" and OK and your new artwork is now there and all good.
    Sounds like a lot of steps to follow but after around 5 or so you will fly through it. This worked perfect on my iPhone 6 Plus and I have artwork on my Home Videos now.

  • Hi, my iphone its in recovery mode and when i restore my iphone 5s loading show the blue screen and show note on itunes (unknown error 14) please i need your help please . thanks

    Hi, my iphone its in recovery mode and when i restore my iphone 5s loading show the blue screen and show note on itunes (unknown error 14) please i need your help please . thanks

    In the article Resolve iOS update and restore errors this is what it says about error 14:
    Check your USB connections
    Related errors: 13, 14, 1600, 1601, 1602, 1603, 1604, 1611, 1643-1650, 2000, 2001, 2002, 2005, 2006, 2009, 4005, 4013, 4014, or “invalid response."
    If the USB connection between your device and computer is interrupted, you may be unable to update or restore.
    To narrow down the issue, you can also change up your hardware:
    Use the USB cable that came with your device, or a different Apple USB cable.
    Plug your cable into a different USB port directly on your computer. Don't plug it into your keyboard.
    Try a different computer.
    If necessary, resolve any further issues with the USB connection, then with your security software.
    If you're still seeing the error message, check for hardware issues by following the next section.

  • Hi! I got movies on my external hard drive that are AVI kind and won't play on my macbook pro? need some help please!!

    Hi! I got Movies on my external hard drive that are AVI kind and won't play on my macbook pro? When I start playing the movie a message pops up and says "a required codec is not available". I tried flip4mac, xvid, divx already and still not playing my video. need some help please!! thanks.

    Although vlc mentioned above is a much more powerful and better player you could try installing Perian if you insist on using the quicktime player.  It may supply the codec it needs.
    Not sure why you wouldn't be able to play straight avi files though in quicktime.

  • HT1199 I need your help, PLEASE. How can to fix "NO MOUNTABLE FILE SYSTEM" error of my back up hard drive on Mountain Lion OS?

    I need your help, PLEASE. How can to fix "NO MOUNTABLE FILE SYSTEM" error of my back up hard drive on Mountain Lion OS?

    Did you format the drive for Mac use before you tried to use it as a backup drive?
    Are you using Time Machine on the drive? You can't view the contents of its backup database and the only way to access the info is directly from the Time Machine app.

  • I need serious help please.. We do translations of schoolbooks, I looked for an over-type function but were unable to find, we are working in indesign CS 5. it takes up allot of time to delete text and type in the new language.

    I need serious help please.. We do translations of schoolbooks, I looked for an over-type function but were unable to find, we are working in indesign CS 5. it takes up allot of time to delete text and type in the new language.

    Argh that's frustrating! I never noticed that key did not work in InDesign.
    A bit of research and it turns out the MS Office has this as an option in their software. But I cannot find an option in InDesign preferences to make this work.
    However, somethings are not listed in the shortcuts and preferences and are hidden triggers in InDesign which can be accessed through a script.
    I'm not saying it's possible to activate the Insert Key through a script, but it's plausible that it can be activated.
    Maybe ask on the scripting forum? InDesign Scripting
    I know this may be a possibility as with InDesign's earlier versions of PDF export to interactive documents there previously was no way to export interactive pdfs as single pages if in Spreads.
    But the option to toggle this setting was scriptable.

  • HT201328 Hey, i bought an iphone from online shop and its locked by orange france, i contact them to unlock it but they refused, they said that we regret to inform you that we'r not able to unlock second hand phones? I need your help please.

    Hey, i bought an iphone from online shop as a used phone and its locked by orange france, i contact them to unlock it but they refused, they said that we regret to inform you that we'r not able to unlock second hand phones? I need your help please. Its not fair , apple should figure it out
    Regards,
    Orange

    This is no different with any carrier locked phone. Getting a carrier locked phone officially unlocked is the responsibility of the carrier, not the cell phone manufacturer. A cell phone manufacture cannot unlock a carrier locked phone without the carrier's authorization.
    An iPhone sold as officially unlocked when new can be used by others as a second hand phone, and the same with any carrier locked iPhone that can be unlocked by the carrier, and many carriers offer it.

  • HT4623 I. Tried many time to install my apple to update software but can't fix I need your help please and Thanks.

    How i fix and software update i was tried but cant i need your help please and thanks.

    "but cant"
    That doesnt tell us anything useful. You need to post EXACTLY what you did and EXACTLY what happened, including any error messages.

  • Need Urgent help please? I need to restore from a previous iphone backup.

    Oops, I admit it - I messed up but need help please?? I received a replacement iphone today. My broken iphone OS and my itunes had the latest software updates and I did a full backup before going to the store to get the rerplacement. However, when I got home with the replacement iphone and plugged it in, it asked if I wanted to update the OS on it. I made the mistake of saying yes. It then made a backup of the empty factory settings from the new replacement and restored from that rahter than the backup I made before going to the store. Yes I know I should have said no and just did the restore which would have resotred my previous backup that I made before going to the store. Then after everything would be allright I could have told it to update the OS.
    You can slap my in the face or I will do it myslef for making such a stupid mistake. All ready did the "I should have had a V" thing to my forehead.
    After seeing the restore was fromthe factory settings rather than my earlier good backup, I went into my documents and drilled down to the mobile sync backup and saw that one of the three folders (with giberish as a title) has a lot of information with the date and time I did the backup before going to the store.
    Could I possibly delete the later (factory setting backup) folder and then do a restore to get my good backup onto the iphone? I didn't do that yet in fear that it might mess something else up on the iphone and I wanted to check with you experts here first for guidance and assistance, PLEASE?
    I'll be anxiously awaiting any help you can give!
    Thank you!!

    rwmac22 wrote:
    Hopt and OneOrangeTree, Thank you both very much for replying!!
    It took me a long time to get back to the dissucison group because I tried both of your suggestions which therfore had to do about 4 restores. They take quite a while (about 50 minutes each actually). Your help got me half way there and is very apprecaited! I did manage (with your excellent help) to get most of my backup put onto the replaced iphone. the photos, music, and videos didn't get put over. I think I can move those back over by making sure they are selected in the seperate tabbed screens for the iphone. However, I can't get to those screens because every time I connect the iphone now, it brings up the "set up your phone screen". The one with the "an iphone has been previously synced with this compter" setup as new phone or restore from ....
    Well I did the resotre from 3 times and that page still comes up when I plug in the iphone. Yes, I did close itunes, reboot the PC, and powered off the iphone and then brouhgt it back up before connecting (all several times), but itunes still takes me to the same "setup iphone screen".
    Can you help me to get it to the standard iphone screen and there I will make sure the selected items are checked and do a sync.
    Please know I do appreicate your kind assistance so far and hope someone can get me the rest of the way!
    The "Backup" do not store your Applications, Music, Video's. It saves your settings, your application preferences, etc.

  • I am the biggest "Newb" on this site,  and I really need some help please..

    Ok, the short of it.... I started training on Database programming about 2 weeks ago. I still don't really know a thing, or even understand the concepts. Now, my boss wants me to fix a bug in Oracle, and I haven't a clue. The ONLY help I've gotten was a link to this forum, and a speech about how I need to help myself. I told him I have the same chance of fixing anything, as monkeys typing hamlet. Anyone up for a challenge?
    When I go to Application System, then Application Entry and enter the password a dialog box appears.... "FRM-40039: Cannot attatch library Empower while opening from APPUSRAPP."
    That's what I have to fix. I have no clue. I don't even really know how to click around in this program. Please help, someone.
    UPDATE: I've been told that everyone's pretty much going to be a jerk to me for asking this, and I'm currently searching old threads and can't find a way to delete this one I posted. So, you could just ignore the post, or jump in and be the internet tough-guy and tell me what I already know.... I'm a newb.
    Edited by: user11033020 on Apr 14, 2009 11:41 AM

    As this appears to be a Forms error (the error begins with FRM) you might get a better response by posting this in the Forms forum:
    Forms
    The Community Feedback forum isn't meant for product-related questions (as it says in the title).
    Still, you should consider searching Metalink as well. If you've paid for support, you have every right to use it.

  • My stupid iphone turned off sundenly and now is saying i have to connect to itunes and it wont connect to itunes i need ur HELP please please please!!!!  whoever helps me u r an amazing person!!!!!

    help please my iphone 4 turned off sundenly and now is not working its says to connect to itunes but when i get to itunes it shuts offf or doesnt work!!! i am depley need help!!! if anybody can help that wuold be amazing!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! HELP

    The problem is your friend's music does not belong to you.  It is owned by your friend.
    I'm afraid you cannot do what you are trying to do.  Restoring the iPhone is what you would have to do.
    In the future, put your music on the computer and transfer it to the iPhone, not the other way.

  • Redeeming and Authorizing my purchased music. MAJOR HELP PLEASE!!

    Okay I've been having this problem for a while now. So the problem is that I have over 40 or more purchases but their were purchased with a different account. They were purchased under my old account with aol. So when I go to get them back and try to authorize them to my computer it says that the account isn't valid or isn't an iTunes or aol account. It might be because I don't have an account with aol anymore. So then it asks me to put the credit card number I used for the aol account to make a new iTunes account and redeem the songs. But the problem is that I put the card number in and everything else and it still denies me! Help please?
    HP Pavilion Desktop   Windows Vista   iTunes 7

    It's trying to convert the old AOL account into an Apple ID. Since it's having trouble doing so, you'll need to contact the iTunes Store team and have them convert it for you. Have your billing address ready (they asked me for it when I had a similar issue). Email them here:
    http://www.apple.com/support/itunes/store/authorization/

  • I need your help, please. I can't get my photostream synchronized

    Dear friends, I need your help again!!!
    My photostream from my computer, windows vista, is not updating the pictures on my photostream in neither one of my IOS devices.
    I'm sure that the photostream in both IOS are turned on. In my computer it is also turned on.
    For example, I tranferred some pictures from a normal file to the photostream in the computer and I expected that them went also to my
    iphone and ipad, but it not occurred.
    Please, do you have some advise for me?
    Thanks in advance.

    first i would try a simple restart of your computer and your iPad and see if they show up after they reboot. Also which folder are you putting them in? on windows there will be a seperate folder in the photostream folder that will show upload/uploads you will want to make sure they are in there. Also here are some basics about photostream to make sure you are meeting all the requirements and are not over your limit, http://support.apple.com/kb/HT4486

Maybe you are looking for

  • BIP not working

    Hi All , I have restarted the OBIEE services today. After restart of services, BI Publisher is not working.I am getting the below error message without any error codes. Oracle BI Publisher Enterprise Reporting Login: java.net.SocketException: Connect

  • Query Using Group Problem

    I have a table like the example below. I am looking to get the results like the example - I have included my code that I have this far, but it is not giving me the right results. Can someone point me in the right direction? This is what I want it to

  • Converting EBS R12 database to RAC 11gR2

    We are on EBS R12 with 11gR2 database. I read the document 823587.1 with emphasis on Section 3. We are planning to convert the existing EBS database to a 2-node RAC on new servers. 1. Install 11gR2 Grid Infrastructure on new servers. 2. Install 11gR2

  • Incompatibility issue - WLC 5508 and ACS 5.4

    Hi, This is my scenario: Cisco WLC 5508 firmware 7.4.110.20 and ACS 5.4, two WLAN eap/tls, many client  can't connect to WLAN and on ACS i receive the following error: Authentication failed : 11051 RADIUS packet contains invalid state attribute worka

  • Q10 remove suggested contacts when composing email

    There's an suggested contact with a typo showing up as frequently used when composing any new email, is there a way to remove it? it's causing me to select the wrong one all the time and is bouncing the message (there's an extra "." at the end of the