Results 1 to 13 of 13
  1. #1
    ITStudent is offline Member
    Join Date
    Jul 2013
    Posts
    25
    Rep Power
    0

    Default Finals Exam Programming Help!!!!!

    Guys I really need help with this so if you know the how to make a program like this please send me the codes

    Write the definition of a class that has the following properties:
    a. The name of the class is Secret.
    b. The class Secret has four instance variables: name of type String, age and weight of type int, and height of type double.
    c. The class Secret has the following methods:
    toString
    setName
    setAge
    setWeight
    setHeight
    getName
    getAge
    getWeight
    getHeight
    default constructor
    constructor with parameters
    d. Write definitions of the method members of the class Secret, as described in part c.
    2.Consider the definition of the following class:
    a. Write the definitions of the methods as described in the definition of the TestClass.
    b. Write a test program(main) ti test various operations of the class TestClass.
    Java Code:
    class TestClass
    {
    private int x;
    private int y;
    //Default constructor to initialize
    //the instance variables to 0
    
    public TestClass()
    {
    }
    
    //Constructors with parameters to initialize the
    //instance variables to the values specified by 
    //the parameters
    //Postcondition: x = a; y = b;
    
    Test Class(int a, int b)
    {
    }
    
    //return the sum of the instance variables
    
    public int sum()
    {
    }
    
    //print the values of the instance variables
    public String toString()
    {
    }
    }
    3. Modify the JFrameDisableButton program so that the JButton is not disabled until the user has clicked it at least five times. At that point,display a JLabel that indicates "That's enough!"
    Java Code:
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    
    public class JFrameDisableButton extends JFrame implements ActionListener
    {
      JButton button = new JButton("Enabled");
      JLabel label = new JLabel("");
      public JFrameDisableButton()
      {
        super("Enabled-Disabled");
        setLayout(new FlowLayout());
        add(button);
        add(label);
        button.addActionListener(this);
      }
    
      public void actionPerformed(ActionEvent e)
      {
      Object source = e.getSource();
      final int LIMIT = 5;
      int i;
      int times = 0;
      {
        if(source == button)
       {
        button.setEnabled(false);
       }
      }
      }
      
      
      
      
      public static void main(String[] args)
      {
        JFrameDisableButton y = new JFrameDisableButton();
        final int FRAME_WIDTH = 300;
        final int FRAME_HEIGHT = 150; 
        y.setSize(FRAME_WIDTH, FRAME_HEIGHT);
        y.setVisible(true);
        y.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
      }
    }

  2. #2
    ITStudent is offline Member
    Join Date
    Jul 2013
    Posts
    25
    Rep Power
    0

    Default Re: Finals Exam Programming Help!!!!!

    For part 1 I have this blueprint
    //Please help me fill this out with your codes.

    public class Secret{

    //4 variables here

    public Secret()
    {
    //default constructor takes no parameters
    //set the default values
    }
    public Secret(parameters)
    {
    //set your 4 variables = to parameters
    }

    //set methods: make your variables equal to the parameter

    //get methods: return the variable
    }

  3. #3
    Junky's Avatar
    Junky is offline Grand Poobah
    Join Date
    Jan 2011
    Location
    Dystopia
    Posts
    3,755
    Rep Power
    7

    Default Re: Finals Exam Programming Help!!!!!

    Quote Originally Posted by ITStudent View Post
    Guys I really need help with this so if you know the how to make a program like this please send me the codes
    That would be plagiarism, academic dishonesty, cheating! Please let me know what your teacher's name is so that I can contact them.

  4. #4
    ITStudent is offline Member
    Join Date
    Jul 2013
    Posts
    25
    Rep Power
    0

    Default Re: Finals Exam Programming Help!!!!!

    umm Why? she said we can do everything consult from the net etc. But no verbal or physical contact with my block-mates.

  5. #5
    ITStudent is offline Member
    Join Date
    Jul 2013
    Posts
    25
    Rep Power
    0

    Default Re: Finals Exam Programming Help!!!!!

    Besides most of them copy from each other. There are many sources of codes in our laboratory but sadly I'm not friends with them.

  6. #6
    Junky's Avatar
    Junky is offline Grand Poobah
    Join Date
    Jan 2011
    Location
    Dystopia
    Posts
    3,755
    Rep Power
    7

    Default Re: Finals Exam Programming Help!!!!!

    Consulting (getting help) is completely different than expecting someone to do the work for you.

  7. #7
    Junky's Avatar
    Junky is offline Grand Poobah
    Join Date
    Jan 2011
    Location
    Dystopia
    Posts
    3,755
    Rep Power
    7

    Default Re: Finals Exam Programming Help!!!!!

    Besides this is not very hard. If you cannot provide your own solutions then you have not been paying attention in class and deserve an F.

  8. #8
    ITStudent is offline Member
    Join Date
    Jul 2013
    Posts
    25
    Rep Power
    0

    Default Re: Finals Exam Programming Help!!!!!

    At least help me with number 2 how do you consider a definition of that class?

  9. #9
    ITStudent is offline Member
    Join Date
    Jul 2013
    Posts
    25
    Rep Power
    0

    Default Re: Finals Exam Programming Help!!!!!

    Okay man if I had more time I could do it. But now only 10 minutes left.
    The Scantron part of the exam was very hard so I wasted most of my time there.

  10. #10
    Junky's Avatar
    Junky is offline Grand Poobah
    Join Date
    Jan 2011
    Location
    Dystopia
    Posts
    3,755
    Rep Power
    7

    Default Re: Finals Exam Programming Help!!!!!

    The code for the constructor has been given to you in the comments.
    What do you think the sum method should do? It is basic mathematics.
    Do you know how to return values from a method? Then you should be able to do the sum and toString methods.

    Once again this is not hard!

  11. #11
    Junky's Avatar
    Junky is offline Grand Poobah
    Join Date
    Jan 2011
    Location
    Dystopia
    Posts
    3,755
    Rep Power
    7

    Default Re: Finals Exam Programming Help!!!!!

    Quote Originally Posted by ITStudent View Post
    Okay man if I had more time I could do it. But now only 10 minutes left.
    The Scantron part of the exam was very hard so I wasted most of my time there.
    That is your problem not ours!

  12. #12
    ITStudent is offline Member
    Join Date
    Jul 2013
    Posts
    25
    Rep Power
    0

    Default Re: Finals Exam Programming Help!!!!!

    Well hope I didn't fail my final exams on her 2 subjects.

  13. #13
    ITStudent is offline Member
    Join Date
    Jul 2013
    Posts
    25
    Rep Power
    0

    Default Re: Finals Exam Programming Help!!!!!

    I have CS114 - JAVA2 and CS101-Computer Organization & Architecture on her two out of the three major subjects I have this semester which is almost over.

Similar Threads

  1. Studying for Finals
    By hockey101 in forum New To Java
    Replies: 11
    Last Post: 01-13-2013, 03:21 PM
  2. Replies: 0
    Last Post: 12-31-2012, 03:24 PM
  3. Replies: 0
    Last Post: 12-28-2012, 03:01 PM
  4. Local Finals
    By Drun in forum New To Java
    Replies: 6
    Last Post: 11-20-2009, 06:50 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •