beginner java help

Discussion in 'Java' started by karatev123@yahoo.com, Oct 11, 2011.

  1. Guest

    * You will be creating a cell phone application with two class
    files, the CellPhone class which dials cell phone numbers entered by a
    user or numbers entered into memory; and the Memory class which
    assigns and returns nine (9) phone numbers stored in memory.

    * The outline for the Memory class is displayed below:

    // Enter your own comments including your name and the due date
    here

    public class Memory
    {
    // Instance variables for up to nine (9) phone numbers in
    memory

    private String memory1;
    private String memory2;
    private String memory3;
    private String memory4;
    private String memory5;
    private String memory6;
    private String memory7;
    private String memory8;
    private String memory9;

    public Memory()
    {
    // No statements required as all Strings for the object
    are initialized to an empty string
    // When instantiated there are no phone numbers stored in
    memory
    }

    // Add the other two (2) methods here ...

    }

    * Add a new void mutator method storeMemory() to the 'Memory'
    class that stores a phone number into one of the memory fields; this
    method takes two parameters: (1) memoryDigit, an int, which is the
    location in which the phone number is to be stored (valid values are 1
    through 9); and (2) memoryNumber, a String, the phone number to be
    stored; use "if" testing for memoryDigit and store the phone number as
    follows: if memoryDigit = 1, assign memoryNumber into the memory1
    field; if memoryDigit = 2, assign memoryNumber into the memory2 field;
    etc.; if memoryDigit is not a value between 1 and 9, do not store the
    phoneNumber but display an error message to the terminal window

    * Add a new accessor method getMemory() of type String to the
    'Memory' class that retrieves a phone number from one of the memory
    fields; this method takes a single parameter memoryDigit, an int,
    which is the location from which the phone number is to be retrieved
    (valid values are 1 through 9); if memoryDigit = 1 return the value
    stored in the memory1 field, if memoryDigit = 2 return the value
    stored in the memory2 field, etc.; if memoryDigit is not a value
    between 1 and 9, return an empty string and display an error message
    to the terminal window

    * The outline for the CellPhone class is displayed below:

    // Enter your own comments including your name and the due date
    here

    public class CellPhone
    {

    // Instance variables

    private String phoneNumber; // The phone number to be dialed
    private Memory mem; // Object instantiated from class
    Memory to store memory phone numbers

    public CellPhone()
    {
    // Write the code to instantiate a new object 'mem' from
    the Memory class
    // Initialize the phoneNumber field to an empty string
    }

    // Add the other five (5) methods here ...

    }

    * Add a new void mutator method setPhoneNumber() to the
    'CellPhone' class that stores a string to the phoneNumber field; this
    method takes a single parameter phoneNumber, a String, which is
    assigned to the phoneNumber field.

    * Add a new void mutator method setToMemory() to the 'CellPhone'
    class that stores a string to one of the memory fields stored in the
    mem object instantiated from the 'Memory' class; this method takes two
    parameters: (1) memoryDigit, an int, which is the location in which
    the phone number is to be stored; and (2) memoryNumber, a String, the
    phone number to be stored; both of these parameter variables are
    passed in a call to the storeMemory method of the 'Memory' class.

    * Add a new void mutator method getFromMemory() to the 'CellPhone'
    class that stores a string to the phoneNumber field; this method takes
    a single parameter memoryDigit, an int, which is the location in the
    mem object of the class 'Memory' from which the phone number is to be
    retrieved; the method calls the getMemory method of the 'Memory'
    class; if the return value is not an empty string assign it to the
    field phoneNumber.

    * Add a new accessor method getPhoneNumber() of type String to the
    'CellPhone' class that returns the phoneNumber field.

    * Add a new accessor method connect() of type String to the
    'CellPhone' class; if the current value of the field phoneNumber =
    empty string, return a string message asking the user to dial a number
    first (to call either setPhoneNumber or getFromMemory method); if the
    current value of the field phoneNumber != empty string, return the
    phoneNumber field by calling its accessor method.
    , Oct 11, 2011
    #1
    1. Advertising

  2. Jeff Higgins Guest

    On 10/11/2011 10:03 AM, wrote:
    > * You will be creating a cell phone application with two class
    > files, the CellPhone class which dials cell phone numbers entered by a
    > user or numbers entered into memory; and the Memory class which
    > assigns and returns nine (9) phone numbers stored in memory.
    >

    Thank you karatev123. Please consider contributing to the free, open
    source, Wikibook; Java Programming, located here:
    <http://en.wikibooks.org/wiki/Java_Programming>
    Jeff Higgins, Oct 11, 2011
    #2
    1. Advertising

  3. Roedy Green Guest

    On Tue, 11 Oct 2011 07:03:40 -0700 (PDT), wrote,
    quoted or indirectly quoted someone who said :

    > * You will be creating a cell phone application


    You just violated the prime directive. See
    http://mindprod.com/jgloss/homework.html
    --
    Roedy Green Canadian Mind Products
    http://mindprod.com
    It should not be considered an error when the user starts something
    already started or stops something already stopped. This applies
    to browsers, services, editors... It is inexcusable to
    punish the user by requiring some elaborate sequence to atone,
    e.g. open the task editor, find and kill some processes.
    Roedy Green, Oct 11, 2011
    #3
  4. On 10/11/2011 9:03 AM, wrote:
    > * You will be creating a cell phone application with two class


    I would be happy to do your homework for you under the following conditions:
    * I am reimbursed at no less than my normal hourly wages, and preferably
    at a much higher rate
    * I am given the complete assignment instructions
    * I am given contact details for the professor so I may inform him or
    her that the student has attempted to have others complete the
    assignment instead of doing it him/herself
    * You sign an agreement saying that you understand that contracting out
    the assignment is often considered cheating in most educational
    constructs and I am ethically obliged to notify the professor of such an
    incident
    * I retain the right to abrogate the contract at any time, for any
    reason, without penalty, and without prior notice.

    --
    Beware of bugs in the above code; I have only proved it correct, not
    tried it. -- Donald E. Knuth
    Joshua Cranmer, Oct 11, 2011
    #4
  5. markspace Guest

    On 10/11/2011 7:03 AM, wrote:

    > * The outline for the Memory class is displayed below:



    Slightly less sarcastically:

    1. Ask your professor, TAs, and classmates these questions. It's
    important for your professor to get feedback from his or her students
    how they are progressing with each assignment.

    2. Speaking of questions, I didn't see any. When asking for help, it's
    usual to put some effort in first and then to present the project as you
    have it, rather than simply copying and pasting your professor's
    assignment verbatim.
    markspace, Oct 11, 2011
    #5
  6. Jeff Higgins Guest

    On 10/11/2011 04:09 PM, markspace wrote:
    > On 10/11/2011 7:03 AM, wrote:
    >
    >> * The outline for the Memory class is displayed below:

    >
    >
    > Slightly less sarcastically:
    >
    > 1. Ask your professor, TAs, and classmates these questions. It's
    > important for your professor to get feedback from his or her students
    > how they are progressing with each assignment.
    >
    > 2. Speaking of questions, I didn't see any. When asking for help, it's
    > usual to put some effort in first and then to present the project as you
    > have it, rather than simply copying and pasting your professor's
    > assignment verbatim.
    >


    Funny. I read the OP as an offer of help, sort of an instructor offering
    up an assignment, rather than a request for help. Given the opposite
    reading I am sure my response would be taken for sarcastic. It wasn't
    intended that way. I seem to be outnumbered in my interpretation.
    Jeff Higgins, Oct 11, 2011
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?S3VydCBTY2hyb2VkZXI=?=

    No Class at ALL!!! beginner/beginner question

    =?Utf-8?B?S3VydCBTY2hyb2VkZXI=?=, Feb 2, 2005, in forum: ASP .Net
    Replies:
    7
    Views:
    562
    =?Utf-8?B?S3VydCBTY2hyb2VkZXI=?=
    Feb 3, 2005
  2. Kristin

    Beginner Java...need help!

    Kristin, Mar 21, 2006, in forum: Java
    Replies:
    5
    Views:
    486
    Bonney Armstrong
    Mar 22, 2006
  3. Rensjuh
    Replies:
    7
    Views:
    954
    Mabden
    Sep 2, 2004
  4. Replies:
    2
    Views:
    338
    TechBookReport
    Sep 5, 2006
  5. william nelson

    Beginner's Beginner

    william nelson, Apr 11, 2011, in forum: Ruby
    Replies:
    7
    Views:
    203
    7stud --
    Apr 12, 2011
Loading...

Share This Page