Martyr2's Profile User Rating: *****

Reputation: 4337 Guru
Group:
Mentors
Active Posts:
12,204 (4.5 per day)
Joined:
18-April 07
Profile Views:
201,880
Last Active:
User is offline Yesterday, 05:15 PM
Currently:
Offline

Previous Fields

Country:
CA
OS Preference:
Windows
Favorite Browser:
Chrome
Favorite Processor:
AMD
Favorite Gaming Platform:
Playstation
Your Car:
Who Cares
Dream Kudos:
0
Expert In:
C/C++, Java, VB, VB.NET, C#, PHP, Web Development, HTML & CSS, Javascript

Latest Visitors

Icon   Martyr2 sings "I'm waking up, I feel it in my bones. Code enough to make my systems 0wN. Welcome to the new age, to the new age."

Posts I've Made

  1. In Topic: Do programmers really work 80 hrs per week?

    Posted 21 Sep 2014

    I am constantly fighting the powers that be on time. "We need this in 2 days" and I am like "Well you should have asked me 8 days ago because it is going to take 10 business days." I think no2pencil had it right at the very beginning, if you are working more than your typical 40 it is probably because someone else screwed up or had some poor planning. Employers need to talk to their devs before they make their decisions as to deadlines and before any promises are made. And they should always pad out that time because in programming one little bug can stop you dead in your tracks for hours if not days.

    But as many have said here already, don't be a sucker and work 80 hours a week. You are doing no one any good. A healthy and happy programmer is going to make better decisions, write less bugs in code and produce way more than someone struggling with burnout on 80 hour weeks. Work life balance is important and needs to be maintained. There is no need to throw your health away for any job.

    :)
  2. In Topic: Java programming a school schedule

    Posted 21 Sep 2014

    Ok well notice how the function you defined has the same name of the class. Both are called "teachers". When this happens the function is said to be the constructor. Meaning it will only be called ONCE when an instance of the object is created. Meaning when you create the variable "Bisset" down in your SchoolSchedules class, it is going to automatically called the "Teachers" method with teaches being set to 2. Just because you set the teaches variable later to 4, you are not calling that function again.

    So what you need to do is create another function in your Teachers class which will be responsible for just printing the characters based on the value of teaches. So take half of that code out of the constructor and put it into its own method. Then you can set teaches and call this method.

    class Teachers{
      int teaches;
      char []subject;
      
      // Constructor that sets teaches to 2 initially
      public Teachers(){
         
         teaches=2;
         
      }  
    
      // Method we call when we want to print characters based on current value of teaches
      public void PrintCharacters() {
        char subject[] = {'a','c','d','e','g','h','i','l','m','n','o','s','t','u'};
                 
        for(int c=1;c<=16;c++){   
         
          teaches = teaches/2; 
    
          if (teaches==1) 
          System.out.println(subject[8]+""+subject[0]+subject[12]+subject[5]+subject[3]+subject[8]+subject[0]+subject[12]+subject[6]+subject[1]+subject[11]);
    
          if (teaches==2) 
          System.out.println(subject[3]+""+subject[9]+subject[4]+subject[7]+subject[6]+subject[11]+subject[5]);
    
          if(teaches==4) 
          System.out.println(subject[11]+""+subject[10]+subject[1]+subject[6]+subject[0]+subject[7]+" "+subject[11]+""+subject[12]+subject[13]+subject[2]+subject[6]+subject[3]+subject[11]);                    
    
          if(teaches==8) 
          System.out.println(subject[11]+""+subject[1]+subject[6]+subject[3]+subject[9]+subject[1]+subject[3]);           
        }      
      }      
    }            
    
    
    public class SchoolSchedules{   
        public static void main(String []args){          
          Teachers Bisset = new Teachers(); //<-- Calls constructor setting teaches to 2
          Bisset.teaches=4;  //<-- Reset teaches to 4
          System.out.println("Mrs. Bisset teaches... ");  
          Bisset.PrintCharacters(); //<-- Call our method to print based on teaches being 4
        }
    
    }
    
    


    Now of course this is not flawless, but with the notes you should get an idea of what is going on here. Create the class Bisset will kick off your constructor setting teaches to 2. We then set it to 4 and from there we call our new method to print the characters.

    Work with this and make the necessary changes. :)
  3. In Topic: Bank Account

    Posted 21 Sep 2014

    You need to re-read what g00se (and your instructions) are telling you. Your debit method has to retrun a boolean... not double like you have it setup. Because of this you are not returning false if the withdraw is greater than the current balance. You should be looking to do something along the lines of....

    public boolean Debit(double amount) {
      if (amount > balance) {  //<--- First test to make sure the balance can cover the withdraw amount
         return false;
      }
    
      // Do other code here
    }
    
    


    As you can see we do a quick test with the amount against the balance. If it is greater than the balance, we immediately return false and do nothing else. Just like the instructions say.

    I am a bit baffled by your comment "I'm not sure how I'm going to be able to get debit and setBalance to work together with each other." They don't have to work together. In fact they don't even need to know about one another. setBalance has one job, set the value of the balance variable. Debit has two jobs, make sure the withdraw amount is not greater than the balance and subtracting the amount from the balance. Two completely different operations here.

    :)
  4. In Topic: Not getting it with BorderLayout

    Posted 21 Sep 2014

    Set each of your JPanels to borderlayout then....

    JPanel left = new JPanel(new BorderLayout());
    JPanel center = new JPanel(new BorderLayout());
    JPanel right = new JPanel(new BorderLayout());
    
    


    As soon as you set these three panels, then you will get your results almost exactly (buttons will need a little padding).

    :)
  5. In Topic: New Experts and Mentor

    Posted 21 Sep 2014

    I once had an addiction to Dream.In.Code too. But now I do not have that addiction anymore. Crack helped me and I am sure it can help you too. Now I am too busy trying to score a bag on the streets than to answer questions. So if you ever need help Oppemaj, I am sure I can help you out of the DIC addiction too! :D/>

    Oh and congrats to you guys!

My Information

Member Title:
Programming Theoretician
Age:
Age Unknown
Birthday:
Birthday Unknown
Gender:
Location:
Vancouver, Canada
Interests:
I love programming and science (almost became a chemist). My favorite languages are C#, Java, Python and PHP. While I am not programming I enjoy movies that feature something medieval (Gladiator, Braveheart etc) or high tech (like Hackers or Swordfish).

I have a diploma in computer science and another in arts and science. My favorite sciences are astronomy, chemistry and geology.

If you have any questions regarding programming, you will find I live and breathe the stuff and should prove an invaluable asset.

Winner of 25 2008-2013 DIC Community Awards including Blog of the Year, Mentor of the Year, DIC Head of the Year, Most helpful Programming Category, Most Helpful in Web Development Category and overall Nicest Member of the year.

You can now catch me on Twitter! Follow me as I talk about technology and specifically programming and answer questions like the best book to learn from or how to organize your code.

http://twitter.com/martyrscry :)
Years Programming:
16
Programming Languages:
C/C++/VC++/C#, VB6/VB.NET, Java, JavaScript, Ruby, HTML/CSS, PHP, ASP/.NET, Python, mIRC Scripting

Contact Information

E-mail:
Private
Website URL:
Website URL  http://www.coderslexicon.com
Facebook:
http://www.facebook.com/coderslexicon
Twitter:
martyrscry

Comments

  • (8 Pages)
  • +
  • 1
  • 2
  • 3
  • Last »
  1. Photo

    Dogstopper Icon

    05 Dec 2013 - 14:39
    Have a 6-year badge good sir!
  2. Photo

    mostyfriedman Icon

    12 Oct 2013 - 21:07
    I am good, busy as well.
  3. Photo

    Martyr2 Icon

    07 Oct 2013 - 12:16
    Good mosty, you? Been busy lately.
  4. Photo

    mostyfriedman Icon

    07 Oct 2013 - 11:26
    Martyr2 my man, how's it going??
  5. Photo

    ishkabible Icon

    22 Aug 2013 - 15:58
    O ah, didn't even realize it. No prob. much deserved!
  6. Photo

    balloon1 Icon

    18 May 2013 - 14:57
    Hi can you help me with one of my questions!
  7. Photo

    groovmuffn Icon

    24 Apr 2013 - 10:10
    Greetings! Newish coder here. I came across your php histogram equalization code the other day and figured I'd try and draft something similar up in javascript. I feel like my code is sound, though something has to be wrong as the output of the image is black with some faint greens. I'm wondering if I am missing something from your original code. Consider perusing a jsFiddle?
  8. Photo

    Martyr2 Icon

    31 Dec 2012 - 12:48
    Thanks lucky3! Winning these types of things always energizes me to continue my work to help everyone I can here. I am a firm believer that we should always provide more than just a quick answer, but teach as well. :)
  9. Photo

    lucky3 Icon

    31 Dec 2012 - 02:23
    Congratulations for the "Mentor of the Year" 1st place, "Nicest Member of the Year" 1st place, "Most Helpful- Web Development" 1st place, and "DIC Blog of the Year" award 3rd place awards! Really impressive, and well deserved.
  10. Photo

    xwordgrl Icon

    27 Dec 2012 - 14:26
    Martyr2, I’m a reporter for the Wall Street Journal and would like to ask you a question about your post on Code Academy. Please email me at sarah.needleman@wsj.com. Thanks!
  11. Photo

    MsParnel Icon

    16 Sep 2012 - 23:17
    Thank you very much for the project list :).
  12. Photo

    ishkabible Icon

    19 Feb 2012 - 20:19
    "This is Chris's basement!!!"
  13. Photo

    Martyr2 Icon

    19 Feb 2012 - 12:47
    Very very true. echo "THIS IS SPARTA!!!";
  14. Photo

    no2pencil Icon

    19 Feb 2012 - 11:51
    It's like the movie 300. 10 times.
  15. Photo

    Martyr2 Icon

    31 Jan 2012 - 16:48
    Thanks macosxnerd! I am glad someone noticed. :)
  • (8 Pages)
  • +
  • 1
  • 2
  • 3
  • Last »