please can any java guru please help me transform this c++ source code to java.would awfully appreciate this help from anyone.
class Article {
private:
float PricePerPiece;
string StripCode,Name;
public:
Article();
Article(float,string,string);
~Article() {
cout << "Message from the \"Article\" - destroyed!" <<
endl;
}
float GetPricePerPiece() const {
return PricePerPiece;
}
void SetPricePerPiece(float X) {
this->PricePerPiece = X;
}
string GetStripCode() const{
return StripCode;
}
void SetStripCode(const string& StripCode){
this->StripCode= StripCode;
}
string GetName()const{
return Name;
}
void setName(const string& X) {
this->Name=X;
}
void Print() const;
};
Article::Article() : PricePerPiece(1), StripCode("A"),Name("X") {
}
Article::Article(float PricePerPiece,string StripCode,string Name) {
this->PricePerPiece = PricePerPiece;
this->StripCode= StripCode;
this->Name=Name;
}
inline void Article::Print() const {
cout << "Price Per Piece = " << PricePerPiece << ", Strip Code = " << StripCode <<"Name = "<<Name;
}
Just because I'm bored this moment and have nothing better in my life to do.
public class Article
{
private float PricePerPiece;
private String StripCOde;
private String Name;
public Article()
{
PricePerPiece = 1;
StripCode = "A";
Name = "X";
}
public Article(float pricePerPiece,string stripCode, string name)
{
PricePerPiece = pricePerPiece;
StripCode = stripCode;
Name = name;
}
public float GetPricePerPiece()
{
return PricePerPiece;
}
public void SetPricePerPiece (float X)
{
PricePerPiece = X;
}
public String GetStripCode()
{
return StripCode;
}
public void SetStripCode(String X)
{
StripCode = X;
}
public String GetName()
{
return Name;
}
public void setName(String X)
{
Name = X;
}
public void Print ()
{
System.out.println("Price per Piece = " + PricePerPiece + ", Strip Code = " + StripCode + ", Name = " + Name);
}
}
I have a feeling it's not 100% correct. I'll leave that to you to figure out. I'm in no way a Java guru. I'm well below average with Java. I'm just quite good with C/C++ and this is pretty easy stuff.