I've never programed in C++, and I have just started to learn C++, but I already get a little bit to complicated homeassignement. Is there anyone willing to help me - let's say solve me this excercise. I would appreciate any help with this and if there is anyone willing to solve the whole program, the point is in understanding it for me, so can it be explained, please.

These are 2 connected problems:


4. Define a class MobilePhone for representing a mobile phone that is given by its device
name, e.g., Motorola RAZR V3, the owner's name, and the telephone number. To that end,
please declare three data elements of type string. Furthermore define the following inline
methods:

– a constructor that initialises each data element,
(please use default values for the owner's name and the telephone number)
– an access method for each data element,
– a method display() that outputs the data elements.
Methods that access an object by reading shall be declared read-only.


5. Two objects of type MobilePhone are passed to a global function
exchangeMobilePhone() as arguments. The function exchanges the names of the owners
and the telephone numbers.

Recommended Answers

All 3 Replies

> and if there is anyone willing to solve the whole program,
Anything else you want while you're at it?
World peace, large trust fund, that kinda stuff.

The moment you give up, and post this kind of thread to a forum is the time you should quit.

> but I already get a little bit to complicated homeassignement
You ain't seen nothing yet. The problems which are coming are much harder than this. Are you going to post all those to some forum as well?
You have to work damn hard to keep on top of this stuff.

Understanding comes from you struggling with the problem and getting occasional help to specific problems.

If you think you'll "understand" just because someone else posts an answer, and you can recite a few memorised sentences for teacher, then you're SOL.

Make an effort!

I understand what are you saying to me, but I cannot make so much effort to solve this by tomorrow, and to completely understand it and to present it, that's why I need someon's help.

Member Avatar for jencas

4. Define a class MobilePhone for representing a mobile phone that is given by its device
name, e.g., Motorola RAZR V3, the owner's name, and the telephone number. To that end,
please declare three data elements of type string.

Just do what you read! Here a litte help:

class MobilePhone
{
    std::string device_name_;
    std::string owners_name_;
    std::string phone_number_;
};
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.