i need plenty help!!! with some C++

Resh's Avatar, Join Date: May 2007
Go4Expert Member
Hi my name is Resh.....i am seriously desperate for some help in C++ can any body help me. This is due on Thursday 10th May 2007 and this is my last resort because i can't get this out PLEASE PLEASE PLEASE HELP!!

SECTION A

In preparation a C++ source file, a programmer has written the assignment statement in long-hand form as shown below:

a = a + 12;

rather than in its short-hand form shown here:

a+=12;

This also applies to other operations such as -,*,/ and %.

Develop a class which reads the source file and provides the necessary operations for replacing the assignment statements as listed below:

a = a + …...; by a+=……;
a = a - ……; by a-=….….;
a = a * ……; by a*=….…;
a = a / …….; by a/=……..;
a = a%…….; by a%=……;

In the above example, the variable ‘a’ is chosen for the purpose of illustration and ‘…’ indicates the rest of the expression that is not of interest to us. For example, in a typical program expressions may appear as:

volt = volt + value*sqrt(root);
fraction = fraction / total;

Write the necessary C++ program to carry out the required transformations.

SECTION B

Extend the class developed in Section A so that:

a) If the message “all” is sent to the object, all assignments are converted to their short form as described in Section A.
b) An assignment of the form t = t + 1
is reduced to its post fixed form t++
c) Explore how the polymorphism feature of C++ could be exploited in this class
Hierarchy
DaWei's Avatar, Join Date: Dec 2006
Team Leader
You wait until the last few days and look to US to earn YOUR grade? Get real.
Resh's Avatar, Join Date: May 2007
Go4Expert Member
That was very mean! I was have been working on it and it is not like i have absolutely nothing... And this was my last resort because it has been giving me more trouble than i realised and i just thought someone might be able to help....
DaWei's Avatar, Join Date: Dec 2006
Team Leader
Quote:
That was very mean!
You sound like a whining baby looking for his mama and a sugar tit.

The only effort you've shown here is in writing your post. There is no reason in the world that we should presume that you are other than lazy. Why? Because you're acting like a huge number of lazy people that we've encountered. If you want to present material that shows that you've busted a sweat of your own, rather than spending all your time conducting panty raids and watching TV, then people will generally form another opinion.

The world does not owe you anything you haven't worked for. Neither do we. At least, I haven't received MY paycheck from you, yet.
ever_thus's Avatar, Join Date: Jan 2007
Contributor
I'm with Resh. You can presume anything in the world about him, but you have no way of knowing whether you approach the truth. And while you certainly don't have any requirement to reply to his question, that doesn't transalate into a right to insult him. Certainly not with such language.
DaWei's Avatar, Join Date: Dec 2006
Team Leader
I don't have to approach the truth. I'm entitled to judge on the basis of experience. I made one judgement on the first post and replied accordingly. I made a further judgement on the second, and replied further. He's certainly welcome to post his homework elsewhere and compare responses.
Resh's Avatar, Join Date: May 2007
Go4Expert Member
DaWei,
Clearly there is no need to be a know it all because you have incorrectly judged me from both messages. Furthermore i don't seek your sympathy and there is no need to behave the way you have.. .Obviuosly your experience has done you no good because you have no idea how to speak the people. I shall not degrade myself to the extent that your have speaking of other people's panty and what not. However for your own knowledge i am not a guy i am a girl so there are no panty raids that is just one of the things that you have assumed wrongfully. Therefore i suggest you get out a bit more and wait a while longer before you decided to judge anyone on your so called EXPERIENCE because obvious you have much to learn.

ever_thus,
Thank you very much for your support clearly you are a nice person. But thank you again
aVague's Avatar, Join Date: May 2007
Go4Expert Member
no use in such speech, instead of it, better tell more clearly , what you need

you dont know principe of shorthand notations or you just wanna know more about them?
DaWei's Avatar, Join Date: Dec 2006
Team Leader
If you're not lazy, don't act like it. I have over 40 years of experience ranging from EE to owner of my own company. The probability of correctness of my judgement is not 1.0, but it's certainly very high.
Resh's Avatar, Join Date: May 2007
Go4Expert Member
Do accept my apologies aVague...

NO actually classes are not my strong point so i did some reading and the program i designed is as follows however my problem with it is i am unsure as to whether i am answering the question from section a in this particular program... Because how i understand it is the section a you need a program to perform the arthmetic tasks and it is not until section b does it need to understand the short hand form.... but that is what i think...

Code:
#include<iostream.h>
#include<conio.h>
// declaration section:
class Arithmetic
{
	private:
		int a;
	public:
		void seta(int a);
		void displayArithmeticOperations();
};
// implementation section:
void Arithmetic::displayArithmeticOperations()
{
	cout<<”Enter initial value of a”<<a<<endl;
	//print message and value to screen
	cout<<”The initial value of a you typed is: “<<a<<endl;
}
void main()
{
	int a= a+12;
	//print message and value to screen
	cout<<”After applying a=a+12 new value of a is: “<<a<<endl;
	int a= a-12;
	//print message and value to screen
	cout<<”After applying a=a-12 new value of a is: “<<a<<endl;
	int a= a*12;
	//print message and value to screen
	cout<<”After applying a=a*12 new value of a is: “<<a<<endl;
	int a= a/12;
	//print message and value to screen
	cout<<”After applying a=a/12 new value of a is: “<<a<<endl;
	int a= a%12;
	//print message and value to screen
	cout<<”After applying a=a%12 new value of a is: “<<a<<endl;
	getch();
}

Last edited by shabbir; 9May2007 at 08:40.. Reason: Code block