Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

ailr tNat wWIll stbre add 3 names to a STACK and display them on screen 4. Creat

ID: 3601362 • Letter: A

Question

ailr tNat wWIll stbre add 3 names to a STACK and display them on screen 4. Create a program that will store/add 3 names to a QUEUE and display them on screen 5. Create a program that will store/add 3 names to a LINKED LIST and display them on screen Programming Challenges: (30 points- 10 points each) Note: Please use the attached programming sheets for your answers - choose the C structure to use for the specific problem -read the questions carefully ORRECT data I. A store owner would like to have a list of customers displayed in the order in which they came into the store. Create a program for the owner that will capture the first names of the customers, store them to a data structure, and then display them on screen. 2. A car dealership would like to have a way to log their cars going into the garage with only one door that shows the order in which the cars must be brought out of the garage. Create a program that will capture the vehicles going into the garage and then display them in the order in which they must come out. 3. Create a program that can add and remove food items to a shopping list Ctri

Explanation / Answer

1. The data structure will be queue.

   Assuming Q class we can have following code:

   Q q;
   string fname, lname;
   while(sentinel condition){
      cin >> fname >> lname;
      q.enqueue(fname);
     
   }
   while (!q.isEmpty()){
       cout << q.dequeue() << endl;
   }

2. The data structure will be Stack

   Assuming Stack class we can have following code:

   Stack<Car> s;
   Car c
   string make,model;
   doubel price;
   while (some condition){
        cin >> make >> model >> price;
        c.setMake(make);
        c.setModel(model);
        c.setPrice(price);
        s.push(car);
   }
   while (!s.isEmpty){
       c = s.pop();
       cout << c.toString() << endl;
   }

3. The data structure will be linked list.

   We will have following code for add and remove:

   Node *add(Node *head, string itemname){
       Node *temp = new Node();
       Node *cur;
       temp->item = itemname;
       temp->next = NULL;

       if (head == NULL){
           head = temp;
       }
       else {
          cur = head;
          while (cur->next != NULL)
               cur = cur->next;
          cur->next = temp;
       }
       return head;
   }

   string remove(Node *head, string itemname){
       Node *temp = new Node();
       Node *cur;
       temp->item = itemname;
       temp->next = NULL;
       string nm;

       if (head == NULL){
           return "Not found";
       }
       else {
          cur = head;
          if (cur->item == itemname){
              head = head->next;
              nm = cur->itemname;
              delete cur;
              return name;
          }
          while (cur->next->item != itemname && cur->next->next != NULL)
               cur = cur->next;
          if (cur->next->item == itemnme){
             cur->next = cur->next->next
          }
          else {
              return "Not found";
          }
       }
      
   }


  

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote