Help

ok so I am being asked to
"Write a class called decimalHexOctalBinary that has four properties mainly decimalUnsignedInt (base 10), hexadecimalUnsignedInt ( base 16), octal UnsignedInt (base 8), and binaryUnsigned Int (base 2). Use gets and sets such that if anyone changes any of these four properties, the other three are altered to have corresponding values. You will need a number of additional private methods (e.g., functions) to implement this class.

Place code within main() to demonstrate that the class works correctly.

Include the UML notion appropriate for this class."

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
31
32
33
34
35
36
/***********************************************************************
#include <iostream>
using namespace std;
class HexOctBinClass
{
public:
	
	HexOctBinClass() 	{
		n = 0;
	}
	
	HexOctBinClass(int nn) {
		setN(nn);
	}
	
	void setN(int nn)	{
		if(nn <0) nn = nn *-1; 
		n = nn;
	}
		int getN() {
		return n;
	}
		void printHexN() {
		cout << "Hex N is: " << hex << n << endl;
	}
	private:
	int n;  // class level variable
};
int main() 
{
	HexOctBinClass foo(10);

	foo.printHexN();
	cout << "Dec N is: " << dec << foo.getN() << endl;
	return 0;
} */


I am lost and the latter code doesnt do what is needed I think I took a step in the wrong way any help would be greatly appreciated



Topic archived. No new replies allowed.