subject

Convert the attached C++ code to working Java code. Be judicious in the change that you make. This assignment is not about re-writing or improving this code, but rather about recognizing the differences between C++ and Java, and making the necessary coding changes to accommodate how Java does things. PLEASE DO NOT use a built-in Java QUEUE (or any other) container. Additional resources for assignment: #include
#include
using namespace std;
class pizza
{
public:
string ingrediants, address;
pizza *next;
pizza(string ingrediants, string address)
{
this->address = address;
this->ingrediants = ingrediants;
next = NULL;
}
};
void enqueue(pizza **head, pizza **tail, pizza *thispizza)
{
if (*head == NULL) *head = thispizza;
else (*tail)->next = thispizza;
*tail = thispizza;
return;
}
pizza* dequeue(pizza **head, pizza **tail)
{
pizza* pizzatodeliver = NULL;

if (*head != NULL)
{
pizzatodeliver = *head;
*head = (*head)->next;
}
if (*head == NULL) *tail = NULL;
return pizzatodeliver;
}
void deliver(pizza **head, pizza`** tail)
{
pizza *thispizza = dequeue(head, tail);
if (thispizza == NULL)
{
cout << "No deliveries pending" << endl; return;
}
cout << "Deliver a pizza with " << thispizza->ingrediants
<< " to " << thispizza->address << endl;
}
int main()
{
pizza *first = NULL, *last = NULL;
enqueue(&first, &last, new pizza("pepperoni", "1234 Bobcat Trail"));
enqueue(&first, &last, new pizza("sausage", "2345 University Drive"));
deliver(&first, &last);
enqueue(&first, &last, new pizza("extra cheese", "3456 Rickster Road"));
enqueue(&first, &last, new pizza("everything", "4567 King Court"));
enqueue(&first, &last, new pizza("coffee beans", "5678 Java Circle"));
deliver(&first, &last);
deliver(&first, &last);
deliver(&first, &last);
deliver(&first, &last);
deliver(&first, &last);
cin. get();
return 0;
}

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 20:50
What does operator overloading allow you to do?
Answers: 2
question
Computers and Technology, 22.06.2019 06:50
Match the personality traits with their description
Answers: 1
question
Computers and Technology, 22.06.2019 11:30
Awell-diversified portfolio needs about 20-25 stocks from different categories.
Answers: 2
question
Computers and Technology, 22.06.2019 11:30
Andrina writes letters that are regularly sent to hundreds of her company’s customers. because of this, she would like for the mail merge command to be in her quick access toolbar, and she wants it to be the first button on the left. what should andrina do to place the mail merge button there?
Answers: 1
You know the right answer?
Convert the attached C++ code to working Java code. Be judicious in the change that you make. This a...
Questions
question
English, 10.02.2020 05:42
question
Social Studies, 10.02.2020 05:42
question
Mathematics, 10.02.2020 05:43
question
Mathematics, 10.02.2020 05:43
question
English, 10.02.2020 05:44