Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and the Yahoo Answers website is now in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.

Lv 32,201 points

j A L

Favorite Answers23%
Answers427
  • Excel question?

    Is there a way to format raw data like:

    Lucroy, Jonathan C - MIL

    ->

    Jonathan Lucroy C - MIL

    Is there an easy way in excel to do this?

    4 AnswersSoftware7 years ago
  • PHP function formatting string?

    I am trying to take a long string (url) and start a new line <br> after 50 characters, because that is all that fits in my area. I have tried to a few things, but this is getting an integer number for length, splitting the string into an array, so then I can call it by index. I tried modulus and if statement, but they don't seem to get the desired result. I am working with a database, so I can't assume anything, but every 50 characters start a new line. Thanks!

    $newText =str_split($text3);

    $count = strlen($text3);

    for($i=0; $i < $count; $i++){

    echo $newText[$i];

    }

    1 AnswerProgramming & Design8 years ago
  • php code problem server?

    when I test my code on local computer, works beautifully, almost too perfect. When I test it on server, works like ****, getting these errors out the gate:

    Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/farruk23/public_html/index.php:3) in /home/farruk23/public_html/core.inc.php on line 4

    Database Error

    Warning: Cannot modify header information - headers already sent by (output started at /home/farruk23/public_html/index.php:3) in /home/farruk23/public_html/loggedin.inc.php on line 4

    5 AnswersProgramming & Design9 years ago
  • Left dog in my car!!!?

    Yeah, so Yesterday I left my dog in my car for 2 minutes, that is right just 2 minutes and some guy had already called the police by the time I got back........ I went to return a video, and by the time I got back he said I called the police. SO, of course I got in my car and got outta there. I got a yellow lab 4 months, but she was in no danger, just barking because I left her alone for a minute. Was this guy a dick for not even waiting a second to see if I was coming back? I think so. According to the SPCA here in NC, your suppose to go into the store and have them announce it on the loud speaker and then if nobody comes, you suppose to dial 911. He just dialed 911 instantly, and for the record I had the windows cracked, but they were not half way down. If I had she would of got out, or more importantly someone would of stole her, she is the cutest lab. I knew I was just going to be a minute, otherwise I would of left her home. It was something like 90 outside.

    10 AnswersDogs10 years ago
  • ebay scam help needed?

    I sold a part on ebay for a friend. It was motorcycle parts, front forks..... I sold it a month ago. After 3 weeks of constantly telling my friend, who was the actual seller to ship item, it never got shipped. The buyer took up a dispute, then a claim on paypal. The amount is something that makes this ridiculous on my part. It sold for $917, and probable the reason why I am most upset. My paypal is now limited b/c I owe that money. My friend keeps telling me that he has my money, but is avoiding me and making so many excuses, that its not even funny.

    Make matters worse, it actually a friend of his parts, and the only good news is that I know where both of them live. I know both of their names and I am about to lose it. Mistake I made: they convinced me that they needed the money to be able to ship the item, so I have already given that to them weeks ago. I found out that the bike was in pawn shop and they had to pay 2800 to get it out. By the time that happened, the buyer wanted refund already. I would of never sold it If I had known that they didnt have the parts, but that is no longer relevant.

    Bottom Line: I am out 900 and sick and tired of thier excuses, and could care less that they are friends. To me, this is strictly business, and could care less about friendship(no friend is worth $900)

    What would you do, I dont believe in revenge(just causes more problems) so do I go to the police, or do I use the police as a threat to get my money or what is the best resolution here????????

    1 AnswerSmall Business1 decade ago
  • C++ Inheritance help needed?

    Hi, I am having problems with a base constructor and a derived constructor for a Car class

    http://pastebin.com/xkqWLV4s

    1 AnswerProgramming & Design1 decade ago
  • I need help with interval notation?

    Express the inequality in interval notation, and then graph the corresponding interval.

    x ≤ 3

    4 AnswersMathematics1 decade ago
  • how much is a calvin johnson topps finest autograph rookie worth?

    its a printing plate card and its 1/1? does anyone know its worth?

    2 AnswersFootball (American)1 decade ago
  • file not found exception java?

    public void actionPerformed(ActionEvent event) throws exception {

    Object source = event.getSource();

    if (source == b1)

    this is where I tried to put it but error, and it wont let you read file without exception handler

    import java.awt.BorderLayout;

    import java.awt.event.ActionEvent;

    import java.awt.event.ActionListener;

    import javax.swing.JOptionPane;

    import javax.swing.JButton;

    import javax.swing.JFrame;

    import javax.swing.JPanel;

    import javax.swing.JTextArea;

    import java.io.*;

    import java.util.Scanner;

    import java.io.IOException;

    public class ViewerFrame extends JFrame {

    private JButton b1,b2;

    private JTextArea field;

    private JPanel panel, panel2;

    public ViewerFrame(){

    super.setTitle("My Reader");

    b1 = new JButton("Open");

    b2 = new JButton("Clear");

    field = new JTextArea(25,25);

    panel = new JPanel();

    panel2 = new JPanel();

    panel.add(b1);

    panel.add(b2);

    panel2.add(field,BorderLayout.CENTER);

    add(panel, BorderLayout.NORTH);

    add(panel2, BorderLayout.CENTER);

    b1.addActionListener(new ActionListener() {

    public void actionPerformed(ActionEvent event) {

    Object source = event.getSource();

    if (source == b1)

    {

    String input = JOptionPane.showInputDialog(null, "Enter Input:", "Dialog for Input",

    JOptionPane.QUESTION_MESSAGE);

    setTitle(input);

    FileReader fileR = new FileReader(input);

    Scanner scan = new Scanner(fileR);

    while (scan.hasNextLine() )

    {

    field.append(scan.nextLine());

    }

    }

    }

    }

    );

    b2.addActionListener(new ActionListener() {

    public void actionPerformed(ActionEvent event) {

    Object source = event.getSource();

    if (source == b2)

    setTitle("My Reader");

    field.setText( "");

    }

    }

    );

    }

    }

    1 AnswerProgramming & Design1 decade ago
  • Java program to read file GUI?

    I need to do the following:

    The first button should be labeled "Open". When clicked, it should ask the user for a file name using a JOptionPane. It should then open the file by creating a FileReader and a Scanner.

    ii. If the file opens successfully, the contents of the file should be read a line at a time using the Scanner object in a loop. Each line should be appended to the JTextArea (after clearing out the existing contents of the text area first). The title of the Frame should be set to the name of the file if successful.

    iii. If the file does not exist, the program should not end - but the contents of the text area should be cleared and the title of the frame should be changed back to "My Reader"

    iv. The second button should be labeled "Clear". When clicked, it should clear the textArea (i.e. set the text to ""). It should also rename the frame title back to " My Reader"

    the clear button works fine as is, but the name of super will change in the previous operation, so dont know how to change it back.

    import java.awt.BorderLayout;

    import java.awt.event.ActionEvent;

    import java.awt.event.ActionListener;

    import javax.swing.JButton;

    import javax.swing.JFrame;

    import javax.swing.JPanel;

    import javax.swing.JTextArea;

    public class ViewerFrame extends JFrame {

    private JButton b1,b2;

    private JTextArea field;

    private JPanel panel, panel2;

    public ViewerFrame(){

    super("My Reader");

    b1 = new JButton("Open");

    b2 = new JButton("Clear");

    field = new JTextArea(25,25);

    panel = new JPanel();

    panel2 = new JPanel();

    panel.add(b1);

    panel.add(b2);

    panel2.add(field,BorderLayout.CENTER);

    add(panel, BorderLayout.NORTH);

    add(panel2, BorderLayout.CENTER);

    b1.addActionListener(new ActionListener() {

    public void actionPerformed(ActionEvent event) {

    Object source = event.getSource();

    if (source == b1)

    field.setText( "Fred was clicked");

    }

    }

    );

    b2.addActionListener(new ActionListener() {

    public void actionPerformed(ActionEvent event) {

    Object source = event.getSource();

    if (source == b2)

    field.setText( " Pat was clicked");

    }

    }

    );

    }

    }

    import javax.swing.JFrame;

    public class ViewerFrameTester {

    public static void main(String[] args) {

    ViewerFrame buck = new ViewerFrame();

    buck.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    buck.setSize(600, 400);

    buck.setVisible(true);

    }

    }

    4 AnswersProgramming & Design1 decade ago
  • linux questions. need help?

    Use the following transcript to answer the next 6 questions.

    [elvis@station elvis]$ ls -R / 2> /dev/null | grep etc | less

    [1]+ Stopped ls --color=tty -R / 2>/dev/null | grep etc | less

    [elvis@station elvis]$ ps

    PID TTY TIME CMD

    1603 pts/2 00:00:01 bash

    2391 pts/2 00:00:00 ls

    2392 pts/2 00:00:00 grep

    2393 pts/2 00:00:00 less

    2394 pts/2 00:00:00 ps

    [elvis@station elvis]$ ls -l /proc/2391/fd

    total 0

    lrwx------ 1 elvis elvis 64 Sep 23 09:49 0 -> /dev/pts/2

    l-wx------ 1 elvis elvis 64 Sep 23 09:49 1 -> pipe:[20966]

    l-wx------ 1 elvis elvis 64 Sep 23 09:49 2 -> /dev/null

    3. Which file (or pipe) is tied to stderr of the ls process?

    A. A pipe to the grep process

    B. /dev/null

    C. /dev/pts/2

    D. A pipe to the less process

    E. None of the above

    4. Which file (or pipe) is tied to stderr of the grep process?

    A. /dev/null

    B. /dev/pts/2

    C. A pipe to the ls process

    D. A pipe to the less process

    E. None of the above

    5. Which file (or pipe) is tied to stdin of the grep process?

    A. A pipe to the less process

    B. A pipe to the ls process

    C. /dev/pts/2

    D. /dev/null

    E. None of the above

    6. Which file (or pipe) is tied to stdin of the less process?

    A. A pipe to the ls process

    B. /dev/pts/2

    C. /dev/null

    D. A pipe to the grep process

    E. None of the above

    7. To what expression would the symbolic link /proc/2392/fd/0 resolve?

    A. /dev/pts/2

    B. pipe:[20966]

    C. /dev/null

    D. /tmp

    E. /dev/tty2

    8. When bash reports the stopped process group, the ls alias has been expanded to ls --color=tty. The --color=tty option tells the ls command to generate color control sequences only if its stdout is tied to a terminal. Which of the following is true?

    A. The ls command generates color control sequences, which can be observed by the less pager.

    B. The ls command does not generate color control sequences.

    C. The ls command generates color control sequences, but they are filtered out by the grep command.

    D. The ls command never generates color control sequences (the --color=tty is only included for purposes of backwards compatibility).

    E. None of the above apply.

    9. Which of the following command lines would allow the less pager to browse grep's error messages, as well as output?

    A. grep root /etc/* 2>&1 | less

    B. grep root /etc/* | less 2>&1

    C. grep root /etc/* >>| less

    D. grep root /etc/* 2| less

    E. None of the above

    1 AnswerComputer Networking1 decade ago
  • linux question, need help?

    The -j command line switch causes the ps command to generate "job control oriented" output. Use the following transcript to answer the next question.

    [elvis@station elvis]$ ls -R / | grep etc | less

    [1]+ Stopped ls --color=tty -R / | grep etc | less

    [elvis@station elvis]$ ps -j

    PID PGID SID TTY TIME CMD

    1215 1215 1215 pts/0 00:00:00 bash

    3242 3242 1215 pts/0 00:00:00 ls

    3243 3242 1215 pts/0 00:00:00 grep

    3244 3242 1215 pts/0 00:00:00 less

    3246 3246 1215 pts/0 00:00:00 ps

    10. Which of the following would be the most reasonable expansion of the second column header, PGID?

    A. Process Group ID

    B. Parent Generation ID

    C. Process Gender ID

    D. Powder Gondola ID

    E. None of the above

    1 AnswerProgramming & Design1 decade ago
  • linux input output questions?

    Linux input output questions?

    Use the following transcript to answer the next 3 questions.

    [prince@station prince]$ cal > cal.out

    [prince@station prince]$ ls -l /dev/stdin

    lrwxrwxrwx 1 root root 17 Apr 1 11:13 /dev/stdin -> ../proc/self/fd/0

    [prince@station prince]$ cat /dev/stdin < cal.out

    September 2003

    Su Mo Tu We Th Fr Sa

    1 2 3 4 5 6

    7 8 9 10 11 12 13

    14 15 16 17 18 19 20

    21 22 23 24 25 26 27

    28 29 30

    8. Which of the following would best describe the file /proc/self?

    A. The file is a symbolic link which resolves to the current login shell.

    B. The file is a symbolic link which resolves to the root directory.

    C. The file is a symbolic link which resolves to /dev/stdout.

    D. The file is a symbolic link which resolves to /tmp.

    E. The file is a symbolic link which resolves to the /proc/pid directory corresponding to the current process.

    9. For the cat process, to what file would the symbolic link /proc/self/fd/0 resolve?

    A. /dev/stdin

    B. cal.out

    C. /dev/tty1

    D. /tmp

    E. /proc/self

    10. For the cat process, to what file would the symbolic link /proc/self/fd/1 most likely resolve?

    A. /proc/self

    B. /tmp

    C. cal.out

    D. /dev/stdin

    E. /dev/tty1

    1 AnswerProgramming & Design1 decade ago
  • pl sql needed for cursor and logic?

    create table MEMBER(

    Member_ID NUMBER PRIMARY KEY,

    First_Name VARCHAR2(25),

    Last_Name VARCHAR2(25),

    Street VARCHAR2(25),

    City VARCHAR2(15),

    Phone CHAR(11),

    Valid_Date DATE,

    message VARCHAR2(200))

    /

    create table TITLE_COPY(

    Copy_ID NUMBER,

    Title_ID NUMBER,

    Status VARCHAR2(30),

    Title_Name VARCHAR2(20),

    constraint TITLE_COPY_PK PRIMARY KEY(Copy_ID,Title_ID))

    /

    create table RENTAL(

    Book_Date DATE,

    Copy_ID NUMBER,

    Member_ID NUMBER,

    Title_ID NUMBER,

    Act_Return_Date DATE,

    Exp_Return_Date DATE,

    constraint RENTAL_PK PRIMARY KEY(Book_Date, Copy_ID),

    constraint RENTAL_FK FOREIGN KEY(Copy_ID,Title_ID) references TITLE_COPY(Copy_ID,Title_ID) on delete cascade)

    /

    create table RESERVATION(

    Reserve_Date DATE,

    Member_ID NUMBER,

    Title_ID NUMBER)

    /

    I understand that I need to check if the video status of my OUT is in and if sql%notfound then i need to insert info into a reservation table. but if the video is in, i need to update status to out. here is what I got so far, not sure if this is the best way to do it.

    Create or replace procedure checkout (

    p_memberid IN member.member_id%type,

    p_titleNum IN rental.title_id%type

    p_video_status OUT title_copy.status%type )

    is

    cnumber number;

    titleNum number;

    cursor c1 is

    select member_id

    from member

    where member_id = p_memberid;

    cursor c2 is

    select title_id

    from rental

    where title_id = p_titleNum;

    begin

    open c1;

    fetch c1 into cnumber;

    close c1;

    open c2;

    fetch c2 into titleNum;

    close c2;

    here are my objectives:

    procedure name is checkout

    pass in customer member# and title# into checkout procedure

    update video status to OUT if the video is available.

    populate a new checkout record into rental table.

    populate a new reservation record into reservation table if the video is not available.

    3 AnswersProgramming & Design1 decade ago
  • pl/sql help needed procedure?

    create table MEMBER(

    Member_ID NUMBER PRIMARY KEY,

    First_Name VARCHAR2(25),

    Last_Name VARCHAR2(25),

    Street VARCHAR2(25),

    City VARCHAR2(15),

    Phone CHAR(11),

    Valid_Date DATE,

    message VARCHAR2(200))

    /

    this is my code:

    it is suppose to add a new member if they do not already exist and give them a new memberid

    CREATE OR REPLACE PROCEDURE add_check_member(

    p_firstName member.first_name%TYPE, p_lastName member.last_name%TYPE,

    p_street member.street%TYPE, p_city members.city%TYPE , p_phone member.phone%TYPE , p_valid member.valid_date%TYPE

    , p_memberId member.member_id%TYPE, p_message member.message%TYPE)

    is

    p_memberId member.id%TYPE :=0;

    CURSOR member_cur

    IS

    SELECT*

    FROM member

    WHERE member_id = p_memberId;

    member_rec member_cur%rowtype;

    BEGIN

    OPEN member_cur;

    FETCH member_cur INTO member_rec;

    IF member_cur%notfound THEN

    SELECT MAX(S_MEMBER_ID) +1

    INTO p_memberId

    FROM member;

    INSERT INTO member VALUES(

    p_memberId, p_firstName, p_lastName, p_street, p_city, p_phone, null);

    DBMS_OUTPUT.PUT_LINE('member ID is : ' || p_memberId);

    DBMS_OUTPUT.PUT_LINE('New member enrollment is done!! : ' );

    ELSE

    select memberId

    From member

    WHERE last_name=p_lastName;

    DBMS_OUTPUT.PUT_LINE('members id is' || memberId );

    END IF;

    CLOSE member_cur;

    EXCEPTION

    WHEN OTHERS THEN

    DBMS_OUTPUT.PUT_LINE('Error Code: ' || SQLCODE);

    DBMS_OUTPUT.PUT_LINE('Error Message: ' || SQLERRM);

    END add_check_member;

    this is my error code:

    PL/SQL: Compilation unit analysis terminated

    PLS-00410: duplicate fields in RECORD,TABLE or argument list are

    not permitted

    3 AnswersProgramming & Design1 decade ago
  • c++ operator overloading problem (10 points)?

    Having some logic errors here and there.

    some of the logical operators are not working properly and the constructor is suppose to let me enter 2/4 and I have to enter 2 enter 4, i guess i just dont undestand how to make a constructor accept 2/4 like that. Thanks!!

    #ifndef RATIONAL_H

    #define RATIONAL_H

    #include <iostream>

    using namespace std;

    class Rational

    {

    public:

    Rational(int numerator = 0,int denominator = 1);

    Rational operator+(const Rational&);

    Rational operator-(const Rational&);

    Rational operator*(const Rational&);

    Rational operator/(const Rational&);

    void reduction();

    Rational operator=(Rational object);

    friend ostream &operator<<(ostream &,Rational &);

    friend istream &operator>>(istream &,Rational &);

    int operator==(Rational object);

    int operator!=(Rational object);

    int operator>(Rational object);

    int operator<(Rational object);

    int operator<=(Rational object);

    int operator>=(Rational object);

    private:

    int numerator;

    int denominator;

    };

    #endif

    #include "Rational.h"

    #include <iostream>

    using namespace std;

    int numerator;

    int denominator;

    Rational::Rational(int n,int d)

    {

    numerator = d < 0 ? -n : n;

    denominator = d < 0 ? -d : d;

    reduction();

    }

    Rational Rational::operator+(const Rational& a)

    {

    Rational t;

    t.numerator = a.numerator * denominator + a.denominator * numerator;

    t.denominator = a.denominator * denominator;

    t.reduction();

    return t;

    }

    Rational Rational::operator-(const Rational& s)

    {

    Rational t;

    t.numerator = s.denominator * numerator - s.numerator * denominator ;

    t.denominator = s.denominator * denominator;

    t.reduction();

    return t;

    }

    Rational Rational::operator*(const Rational& m)

    {

    Rational t;

    t.numerator = m.numerator * numerator;

    t.denominator = m.denominator * denominator;

    t.reduction();

    return t;

    }

    Rational Rational::operator/(const Rational& v)

    {

    Rational t;

    t.numerator = v.denominator * numerator;

    t.denominator = denominator * v.numerator;

    t.reduction();

    return t;

    }

    void Rational::reduction()

    {

    int largest;

    largest = numerator > denominator ? numerator : denominator;

    int gcd = 0; // greatest common divisor

    for ( int loop = 2; loop <= largest; loop++ )

    if ( numerator % loop == 0 && denominator % loop == 0 )

    gcd = loop;

    if (gcd != 0)

    {

    numerator /= gcd;

    denominator /= gcd;

    }

    }

    Rational Rational::operator=(Rational object)

    {

    numerator=object.numerator;

    denominator=object.denominator;

    return(*this);

    }

    ostream &operator<<(ostream &output,Rational &object)

    {

    output<<object.numerator<<"/"<<object.denominator<<endl;

    return output;

    }

    istream &operator>>(istream &input,Rational &object)

    {

    input>>object.numerator;

    input>>object.denominator;

    return input;

    }

    int Rational::operator==(Rational object)

    {

    if(numerator==object.numerator && denominator==object.denominator)

    return(1);

    else

    return(0);

    }

    int Rational::operator!=(Rational object)

    {

    if(numerator!=object.numerator || denominator!=object.denominator)

    return(1);

    else

    return(0);

    }

    int Rational::operator>(Rational object)

    {

    return((numerator/denominator)>(object.numerator/object.denominator) ? 1:0);

    }

    int Rational::operator<(Rational object)

    {

    return((numerator/denominator)<(object.numerator/object.denominator) ? 1:0);

    }

    int Rational::operator>=(Rational object)

    {

    return (numerator * object.denominator) >= (object.numerator * denominator);

    }

    int Rational::operator<=(Rational object)

    {

    return (numerator * object.denominator) <= (object.denominator * numerator);

    }

    1 AnswerProgramming & Design1 decade ago
  • do I do this basketball trade?

    I trade collison and salmons

    for

    nene ray allen

    i'd still have wall and devin harris at PG

    I got a ton of guys at sf/sg like melo, s-jax egordon to name a few...

    I could use the help in fg% from nene and 3's from allen.........

    its a cat league

    1 AnswerFantasy Sports1 decade ago
  • overloading operators in c++?

    is this correct way to do it?

    class Time

    {

    public:

    bool Time::operator ==(const Time &other) const

    friend std::ostream& operator<<(ostream&, Time&);

    private:

    int hour;

    int minute;

    };

    bool Time::operator==(const Time &other) const {

    return !(*this == other);

    }

    ostream& operator<<(ostream &out, Time &ob) {

    out << “Time : ”<<ob.hour << ob.minute<<endl;

    return out; }

    2 AnswersProgramming & Design1 decade ago
  • c++ looping through a array test condition (10 points)?

    void IntegerSet::printSet()

    {

    int i, count=0;

    for(i=0;i<SIZE;i++)

    if(a[i]==1)

    {

    count++;

    cout<<i<<" ";

    }

    if(count==0)

    cout<<"---";

    }

    I need to add some code to the print function I have defined so that only 20 elements show up on each line...... I understand I need something like if count = 20 cout<<endl; but by adding an if in the middle, it does nothing.... this condition I got now works great, prints everything as expected, just need a little assistance thanks........

    2 AnswersProgramming & Design1 decade ago
  • how would I print rational numbers in C++?

    I just need to define printRational() and printRationalAsDouble()

    everything else seems to work just fine......not sure how to print a fraction though

    here is what I got so far.......

    #ifndef RATIONAL_H

    #define RATIONAL_H

    #

    using std::ostream;

    #

    using std::istream;

    #

    #

    class Rational{

    public:

    rational(int num, int den);

    rational(int num);

    rational();

    int getnum();

    int getden();

    void input(istream& in);

    void output(ostream& out);

    bool less(Rational r);

    Rational neg();

    Rational addition(Rational r);

    Rational subtraction(Rational r);

    Rational multiplication(Rational r);

    Rational division(Rational r);

    private:

    int numer;

    int denom;

    };

    #include "Rational.h"

    #include <iostream>

    #include <cmath>

    using namespace std;

    int Rational::getnum()

    {

    return numer;

    }

    int Rational::getden()

    {

    return denom;

    }

    Rational::rational(int num, int den)

    {

    numer = num;

    denom = den;

    }

    Rational::rational(int num)

    {

    numer = num;

    denom = 1;

    }

    Rational::rational()

    {

    numer = 1;

    denom = 1;

    }

    Rational::rational addition(Rational r)

    {

    Rational l;

    int a = l.getnum();

    int b = l.getden();

    int c = r.getnum();

    int d = r.getden();

    Rational result = ((a * d + b * c) / (b * d));

    return result;

    }

    Rational::rational subtraction(Rational r)

    {

    Rational l;

    int a = l.getnum();

    int b = l.getden();

    int c = r.getnum();

    int d = r.getden();

    Rational result = ((a * d - b * c) / (b * d));

    return result;

    }

    Rational::rational multiplication(Rational r)

    {

    Rational l;

    int a = l.getnum();

    int b = l.getden();

    int c = r.getnum();

    int d = r.getden();

    Rational result = ((a * b) / (c * d));

    return result;

    }

    Rational::rational division(Rational r, Rational l)

    {

    int a = l.getnum();

    int b = l.getden();

    int c = r.getnum();

    int d = r.getden();

    Rational result = ((a * d) / (c * b));

    return result;

    }

    bool Rational::less(Rational r)

    {

    Rational l;

    int a = l.getnum();

    int b = l.getden();

    int c = r.getnum();

    int d = r.getden();

    if ((a * d)<(c * b))

    return true;

    else

    return false;

    }

    void Rational::input(istream& in)

    {

    int numer;

    int denom;

    char slash;

    in >> numer >> slash >> denom;

    return;

    }

    void Rational::output(ostream& out)

    {

    cout<<numer<<"/"<<denom;

    }

    this is my tester

    #include "Rational.h" // include definition of class Rational

    #include <iostream>

    using namespace std;

    int main()

    {

    Rational c( 2, 6 ), d( 7, 8 ), x; // creates three rational objects

    c.printRational(); // prints rational object c

    cout << " + ";

    d.printRational(); // prints rational object d

    x = c.addition( d ); // adds object c and d; sets the value to x

    cout << " = ";

    x.printRational(); // prints rational object x

    cout << '\n';

    x.printRational(); // prints rational object x

    cout << " = ";

    x.printRationalAsDouble(); // prints rational object x as double

    cout << "\n\n";

    c.printRational(); // prints rational object c

    cout << " - ";

    d.printRational(); // prints rational object d

    x = c.subtraction( d ); // subtracts object c and d

    cout << " = ";

    x.printRational(); // prints rational object x

    cout << '\n';

    x.printRational(); // prints rational object x

    cout << " = ";

    x.printRationalAsDouble(); // prints rational object x as double

    cout << "\n\n";

    c.printRational(); // prints rational object c

    cout << " x ";

    d.printRational(); // prints rational object d

    x = c.multiplication( d ); // multiplies object c and d

    cout << " = ";

    x.printRational(); // prints rational object x

    cout << '\n';

    x.printRational(); // prints rational object x

    cout << " = ";

    x.printRationalAsDouble(); // prints rational object x as double

    cout << "\n\n";

    c.printRational(); // prints rational object c

    cout << " / ";

    d.printRational(); // prints rational object d

    x = c.division( d ); // divides object c and d

    cout << " = ";

    x.printRational(); // prints rational object x

    cout << '\n';

    x.printRational(); // prints rational object x

    cout << " = ";

    x.printRationalAsDouble(); // prints rational object x as double

    cout << endl;

    system("pause");

    return 0;

    } // end main

    3 AnswersProgramming & Design1 decade ago