# help me in c++



## GSquadron (Jun 9, 2011)

*help me in JAVA and C++*

Hi guys! 
I need help im c++ programing . I have a homework to do:
I need to write a class in C++ which implements 2 methods. The first one must do the sum of numbers from 1 to n and the second to calculate with the recorsive method the factorial n. Than i need to write another class which inherits the first one and it needs to implement a method int m (int n) which makes the operation of numbers from 1 to n =100 + n!
Pls help me!!!!!


----------



## ctrain (Jun 9, 2011)

http://www.cplusplus.com/doc/tutorial/classes/

do your own homework.


----------



## GSquadron (Jun 9, 2011)

In 2 months?


----------



## Disparia (Jun 9, 2011)

You always have such interesting homework. Not so much the requests themselves, but that it jumps around PHP, ASP, C++, etc.

Either this class is structured in such a way as to get students familiar with a wide range of languages or perhaps you are supplying homework for other students?

In the first case, you need to start taking better notes and stop ogling the girls in your class! You'll get plenty of girls later on with slick efficient code and a well normalized database - but you gotta learn it first. Giving you the code won't help much if you can't explain it or apply it to your situation.

In the second case, if you're getting paid, we need to get paid 


If (you're truely needing help) && (are really stuck), post your work so far and we'll try to assit you.


----------



## Widjaja (Jun 9, 2011)

Lol does look like the OP wants to get someone else to do his/her homework.

Best option is to start as far as you can go by yourself even if the whole code is fail so there is a starting point in guiding you to understanding what you did wrong.


----------



## CrackerJack (Jun 9, 2011)

Yea I'm kinda lost, what classes are you taking?!? My classes were all within the same area of field.. ex app dev: c#,java, vb etc. with a few web design classes, but nothing fancy just basics.


----------



## Zyon (Jun 10, 2011)

Think something like this could work


```
Only slaves of Zyon can see this free code.
```

For the factorial try replacing the + on return with * (but not the one next in m + 1).

Basically make a recursion calculation (get the value by calling the function itself until there is a point where it returns a constant rather than a function).

But if you really want it bad I can PM you.


----------



## GSquadron (Jun 10, 2011)

I am at work right now and i have written the code home. 
When i get the code i will post it here, as much as i have written.
Also, a "robot" student, told me it was wrong. 
What is weird here is that how can people think i am such DUMP to do others homework using this forum???


----------



## streetfighter 2 (Jun 10, 2011)

Aleksander Dishnica said:


> What is weird here is that how can people think i am such dump*ing* *homework on*to do others homework using this forum???


FTFY?

The reason why people are getting that impression is it seems you are approaching common programming exercises with, sorry for being blunt, absolutely no idea what you're doing.

Usually when someone has a problem with their code they post the code and explain the nature of the error.  The fact that you don't speak english natively is a significant impediment to the process but it's still a necessity that you post your work/results.

This issue comes up so much that someone made a site dedicated to it:
http://sscce.org/

Here's an example of mine.


----------



## Kreij (Jun 11, 2011)

Alek, I know you're a good guy and help other people here on TPU.
Just post the code you have written up to this point. We will help you find the problems.

The reason that people have doubts about what you are doing is that writing methods and classes is the MOST BASIC things you learn in any object oriented programming (OOP) class and the math needed is grade school level addition and factoring.

Many times I have run across teachers/professors who are very knowldgeable on the topic they teach, but have zero teaching skills and that leave a lot of students lost as to what they are supposed to do. 
If you do not understand the basics of OOP or the math, we will help you.

If you have basic questions, ask them one at a time and we will make sure you understand the underlying concepts of OOP. 
If you ask them all at once you will get information overload and not learn anything as the concepts build on each other.
You MUST understand the basics or you will never understand how to apply them in an even moderately complex application (which will probably be your next homework assignment).

We will teach you, we just will not spoon feed it to you, because if we do you will never learn it and that will do you no good.


----------



## GSquadron (Jun 11, 2011)

Unfortunately i have written the code in my own language, but i think you understand me guys so there is no need at all for the name of classes, also i know it is WRONG:

```
public class Punetori 
{
public punetori();
private string emri();
private string mbiemri();
private double pagamujore(int ditepune)(paga mujore=dite pune*paga ditore);
}
public class mjeti
{
public mjeti();
public string get emri();
public string get mbiemri();
public double get pagaditore();
}
public class shefi implements Mjeti
{
public string setemri(ilir);
public string setmbiemri(kasemi);
public double setpagaditore(200);
}
public class fatorino impelements Mjeti
{
public string setemri(filan);
public string setmbiemri(fisteku);
public double setpagaditore(130);
public string setemri(fisteku);
public string setmbiemri(filan);
public double setpagaditore(150);
}
public class test impelements Mjeti
{
public main ();
public string emri(filan);
public string mbiemri(fisteku);
public double(paga ditore);
system out println(paga mujore);

public string emri(fisteku);
public string mbiemri(filan);
public double (paga ditore);
system out println(paga mujore);

public string emri(ilir);
public string mbiemri(kasemi);
public double(paga ditore);
system out println(paga mujore);

}
```
Also, the CODE IS IN JAVA! Because i have 2 homeworks.... one guy on here helped me with C++


----------



## CrackerJack (Jun 11, 2011)

Aleksander Dishnica said:


> Unfortunately i have written the code in my own language, but i think you understand me guys so there is no need at all for the name of classes, also i know it is WRONG:



please wrap your cope... ex:


```
public class Punetori 
{
public punetori();
private string emri();
private string mbiemri();
private double pagamujore(int ditepune)(paga mujore=dite pune*paga ditore);
}
public class mjeti
{
public mjeti();
public string get emri();
public string get mbiemri();
public double get pagaditore();
}
public class shefi implements Mjeti
{
public string setemri(ilir);
public string setmbiemri(kasemi);
public double setpagaditore(200);
}
public class fatorino impelements Mjeti
{
public string setemri(filan);
public string setmbiemri(fisteku);
public double setpagaditore(130);
public string setemri(fisteku);
public string setmbiemri(filan);
public double setpagaditore(150);
}
public class test impelements Mjeti
{
public main ();
public string emri(filan);
public string mbiemri(fisteku);
public double(paga ditore);
system out println(paga mujore);

public string emri(fisteku);
public string mbiemri(filan);
public double (paga ditore);
system out println(paga mujore);

public string emri(ilir);
public string mbiemri(kasemi);
public double(paga ditore);
system out println(paga mujore);

}
```


----------



## Kreij (Jun 11, 2011)

I'm sorry Alek, but I have absolutely no idea what the code you posted is supposed to do.
It does not appear to be anything like what you asked in the your OP.
Not being in English makes it even more difficult. Can you translate it to English for us?
Also, why is it in Java if you need C++ code? I'm really confused.


----------



## DaveK (Jun 11, 2011)

God damn, now I'm _really_ scared that I'm going to find computer programming tough when I get into college...


----------



## Frick (Jun 11, 2011)

DaveK said:


> God damn, now I'm _really_ scared that I'm going to find computer programming tough when I get into college...



Naaah, I don't know what Aleks teachers is about but most of the stuff his doing make it seems like he have no teacher guidance at all. Also you will read it in english.


----------



## Kreij (Jun 11, 2011)

DaveK said:


> God damn, now I'm _really_ scared that I'm going to find computer programming tough when I get into college...



Don't worry. We've got you covered. 
If the coders on TPU can't get you through a programming class, no one can.


----------



## CrackerJack (Jun 11, 2011)

Kreij said:


> I'm sorry Alek, but I have absolutely no idea what the code you posted is supposed to do.
> It does not appear to be anything like what you asked in the your OP.
> Not being in English makes it even more difficult. Can you translate it to English for us?
> Also, why is it in Java if you need C++ code? I'm really confused.



Yea i was clueless on that code... turning the monitor upside down, and it made more sense that away.


----------



## GSquadron (Jun 11, 2011)

Ok, so i have 2 homework. One in C++ (one of the TPU members helped me out) and one in JAVA which is the one i am writting. I also translated it for you:

```
public class Worker 
{
public worker();
private string name();
private string surname();
private double monthlywage(int dailywage)(monthly wage=days work*daily wage);
}
public class Tool
{
public tool();
public string get name();
public string get surname();
public double get dailywage();
}
public class Boss implements Tool
{
public string setname(ilir);
public string setsurname(kasemi);
public double setdailywage(200);
}
public class Underboss implements Tool
{
public string setname(filan);
public string setsurname(fisteku);
public double setdailywage(130);
public string setname(fisteku);
public string setsurname(filan);
public double setdailywage(150);
}
public class Test impelements Tool
{
public main ();
public string name(filan);
public string surname(fisteku);
public double(daily wage);
system.out.println(monthly wage);

public string name(fisteku);
public string surname(filan);
public double (daily wage);
system.out.println(monthly wage);

public string name(ilir);
public string surname(kasemi);
public double(daily wage);
system.out.println(monthly wage);

}
```

The objective is to find the monthly wage of one boss and 2 underboss.
Boss name is Ilir Kasemi. First underboss name is Filan Fisteku and 2nd is Fisteku Filan.


----------



## Zyon (Jun 12, 2011)

What is this? To get the wage of the Boss and the two Underbosses?

Boss (Ilir Kasemi): 200
Underbosses
Filan Fisteku: 130
Fisteku Filan: 150

You don't have 'days work' set so how do you figure out the 'monthly wage'?

This is confusing =/ on top of it everything is public variable which is bad programming practice.


----------



## GSquadron (Jun 12, 2011)

Man you don't understand there is an incapsulation? Don't you see any private written in the code? 
Also, monthly wage is set in the Worker class at the beggining.
I have written it clearly SYSTEM.OUT.PRINTLN (MONTHLY WAGE).


----------

