Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support |

#1
February 7th, 2013, 11:54 AM
 swab1991
Registered User

Join Date: Feb 2013
Posts: 1
Time spent in forums: 2 m 52 sec
Reputation Power: 0
Homework - 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
February 7th, 2013, 11:57 AM
 stdunbar
Contributing User

Join Date: May 2004
Location: Superior, CO, USA
Posts: 2,398
Time spent in forums: 1 Month 2 Weeks 18 h 14 m 25 sec
Reputation Power: 1660
Quote:
 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.
tvc3mye agrees!
Aurum84 agrees!
__________________
Need Java help? Want to help people who do? Sit down with a cup of Java at the hotjoe forums.

 Viewing: Dev Shed Forums > Programming Languages > Java Help > Homework - Data structures in java