Can someone change this into java so I understand what is happening? switch (inp
ID: 3637826 • Letter: C
Question
Can someone change this into java so I understand what is happening?switch (input1)
{
case 'A': //Add Member
{
cout << "Please enter a member information to add: ";
cin >> inputInfo;
StaffMember * newStaffMember = StaffMemberParser::parseStringToMember(inputInfo);
memberList.push_back(newStaffMember);
break;
}
case 'C': //Compute Pay
for (int j=0; j < memberList.size(); j )
{
memberList.at(j)->computePay();
}
cout << "pay computed ";
break;
case 'D': //Search for Member
cout << "Please enter a memberID to search: ";
cin >> inputInfo;
operation = false;
for (int j=0; j < memberList.size(); j )
{
if (inputInfo == memberList.at(j)->getMemberId())
{
operation = true;
}
}
if (operation == true)
cout << "member found ";
else
cout << "member not found ";
break;
case 'L': //List Members
if (memberList.size() == 0)
{
cout << "no member " << endl;
}
else
{
for (int j=0; j < memberList.size(); j )
{
memberList.at(j)->printInfo();
}
}
At least what is this in java?
StaffMember * newStaffMember = StaffMemberParser::parseStringToMember(inputInfo);
memberList.push_back(newStaffMember);
Explanation / Answer
Hi, my friend this program is simple and most of the logic of the switch and the for loop is the same as java this statement u want here i think this is not the full the code of the program there must be a class that contains the function parseStringToMember and if u ask for this StaffMember * newStaffMember this is not legal unless the (*) is overloaded i don`t know if this is allowed in java but in c++ u can overload the operators for classes so u need to check the class if there is function overload for * memberList.push_back(newStaffMember); //here simple he calls a function from the class and push a value into it so i will assume the class have an array member storing the data if u have the full program i will be glad to check it for u and make sure what this statement means