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, 22.06.2019 11:10
Look at the far left lane in the picture. explain what the red car is doing and what it needs to do to travel safely.
Answers: 2
question
Computers and Technology, 23.06.2019 03:00
State 7 common key's for every keyboard
Answers: 1
question
Computers and Technology, 23.06.2019 06:00
Respond to the following in three to five sentences. select the workplace skill, habit, or attitude described in this chapter that you believe is most important for being a successful employee.
Answers: 1
question
Computers and Technology, 23.06.2019 14:00
Select the correct answer. andre was recently hired by an organization to check for system vulnerabilities. he is supposed to exploit these vulnerabilities and create a report on the extent of damage to which the system was susceptible. what position does andre hold in this organization? a. information security analyst b. information assurance manager c. penetration tester d. network security engineer e. chief information security officer
Answers: 2
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
Mathematics, 09.09.2021 22:20
question
Mathematics, 09.09.2021 22:20
Questions on the website: 13722367