Answer to Question #185713 in C++ for Rameen

Question #185713


Q.No.3: Define a class called token number that incorporates a tokens number (could be the last 3 digits of your arid number) and its location. Number each token object as it is created. Use two variables of the angle class to represent the tokens latitude and longitude. A member function of the token class should get a position from the user and store it in the object; another should report the serial number and position. Design a main() program that creates three token, asks the user to input the position of each, and then displays each tokens number and positio


1
Expert's answer
2021-04-26T14:16:37-0400
#include <iostream>
using namespace std;


class tokennumber {


   private:
    double token_num;
    double token_lattitude;
    double token_longitude;


   public:


    void getData(double tok_num, double tok_latt, double tok_longi) {
        token_num=tok_num;
        token_lattitude=tok_latt;
        token_longitude=tok_longi;
      
    }


    double calculateloc() {
        return token_lattitude + token_longitude;
    }


  
};


int main() {


   tokennumber  tokennumber1;
    tokennumber  tokennumber2;
    tokennumber  tokennumber3;
   
    tokennumber1.getData(931, 30.8, 19.2);
    tokennumber2.getData(415, 33.8, 11.4);
    tokennumber3.getData(315, 23.8, 61.4);


    cout << "position of token 1 =  " << tokennumber1.calculateloc() << endl;
    cout << "position of token 2 =  " << tokennumber2.calculateloc() << endl;
    cout << "position of token 3 =  " << tokennumber3.calculateloc() << endl;
  


    return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS