#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2013
    Posts
    1
    Rep Power
    0

    Question Data structures in java


    Suppose a real number is represented by java class, such as public class Real { private long left, right where left and right represent the digits to the left and right of the decimal point, respectively. If left is a negative integer, then the represented real number is negative.
    a. write a routine to input a real number, and create an object representing that number.
    b. write a function that accepts such a structure and returns the real number represented by it.
    c. write routines add, subtract and multiply that accept two such structures and set the valure of the third structure to represent the number that is the sum, difference, and product, respectively, of the two input records.
  2. #2
  3. Contributing User
    Devshed Regular (2000 - 2499 posts)

    Join Date
    May 2004
    Location
    Superior, CO, USA
    Posts
    2,418
    Rep Power
    1713
    Originally Posted by swab1991
    Suppose a real number is represented by java class, such as public class Real { private long left, right where left and right represent the digits to the left and right of the decimal point, respectively. If left is a negative integer, then the represented real number is negative.
    a. write a routine to input a real number, and create an object representing that number.
    b. write a function that accepts such a structure and returns the real number represented by it.
    c. write routines add, subtract and multiply that accept two such structures and set the valure of the third structure to represent the number that is the sum, difference, and product, respectively, of the two input records.
    Congratulations! You have successfully copied and pasted your homework and, in the process, proven that you've got nothing to show that you've even started the assignment.

    If you have a question or get stuck, post that. Don't expect people do you your homework for you.

    Comments on this post

    • tvc3mye agrees
    • Aurum84 agrees

IMN logo majestic logo threadwatch logo seochat tools logo