Answer to Question #179679 in C++ for tatheer

Question #179679

Create a class Android_Device. The data members of the class are IMEIno (int), Type (String), Make (String), Modelno (int), Memory(float), Operating_System(String). Then Implement member functions to:

1. Set the values of all data members.

2. Display the values of all data members


1
Expert's answer
2021-04-08T18:15:36-0400
#include <iostream>

class Android_Device {
    int IMEIno;
    std::string type;
    std::string make;
    int modelno;
    float memory;
    std::string operating_system;
public:
    void Set(int imei
        , std::string tp
        , std::string mk
        , int no
        , float mem
        , std::string os
    ) {
        IMEIno = imei;
        type = tp;
        make = mk;
        modelno = no;
        memory = mem;
        operating_system = os;
    }

    void Display() {
        std::cout << "IMEIno: " << IMEIno << "\n";
        std::cout << "Type: " << type << "\n";
        std::cout << "Make: " << make << "\n";
        std::cout << "Modelno: " << modelno << "\n";
        std::cout << "Memory: " << memory << "\n";
        std::cout << "OS: " << operating_system << "\n";
    }

};

int main() {
    Android_Device device;
    device.Set(1, "some type", "maker", 2, 1024.f, "Windows");
    device.Display();
    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

atiqa saeed
19.10.22, 18:09

thanks :) ..you a great person

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS