1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
gayaneshka [121]
3 years ago
9

Create a linked list for library patrons. Put at least 8 patrons in the list. (You should hard code this data.) Ask for a person

's name. Tell if the person is in the list or not. If the person is in the list, show the person's information. Data fields are: Name, Library card number, Street, City, Zip
Computers and Technology
1 answer:
Evgesh-ka [11]3 years ago
7 0

Answer:

Explanation:

#include <bits/stdc++.h>

using namespace std;

/* Link list node */

class Node

{

public:

string Name;

long Library_card_number;

string Street;

string City;

long Zip;

Node* next;

};

/* Given a reference (pointer to pointer) to the head

of a list and an int, push a new node on the front

of the list. */

void push(Node** head_ref,string name,long lcn,string street,string city,long zip)

{

/* allocate node */

Node* new_node = new Node();

/* put in the key */

new_node->Name = name;

new_node->Library_card_number = lcn;

new_node->Street = street;

new_node->City = city;

new_node->Zip = zip;

/* link the old list off the new node */

new_node->next = (*head_ref);

/* move the head to point to the new node */

(*head_ref) = new_node;

}

/* Checks whether the value x is present in linked list */

Node* search(Node* head, string x)

{

Node* current = head; // Initialize current

while (current != NULL)

{

if (current->Name == x)

return current;

current = current->next;

}

return NULL;

}

/* Driver program to test count function*/

int main()

{

/* Start with the empty list */

Node* head = NULL;

int x = 21;

/* Use push() to construct below list

14->21->11->30->10 */

push(&head, "Joe",1,"hippy Street","Bay area",2009);

push(&head, "Marie",2,"lippy street","san jose",2010);

push(&head, "Harry",3,"gippy Street","Bay area",2009);

push(&head, "Ashish",4,"dippy street","san jose",2010);

push(&head, "Zuck",5,"sippy Street","Bay area",2009);

push(&head, "Gates",6,"kippy street","san jose",2010);

push(&head, "Page",7,"pippy Street","Bay area",2009);

push(&head, "Brin",8,"dippy street","san jose",2010);

string name;

cout<<"Enter name of the person to search: ";

cin>>name;

Node* z = search(head,name);

if(z!=NULL){

cout<<"\nPerson found in the list"<<endl;

cout<<"Name: "<<z->Name<<endl;

cout<<"Library Card Number: "<<z->Library_card_number<<endl;

cout<<"Street: "<<z->Street<<endl;

cout<<"City: "<<z->City<<endl;

cout<<"Zip: "<<z->Zip<<endl;

}else{

cout<<"No person found with the name "<<name<<endl;

}

return 0;

}

You might be interested in
In traditional programming, probably the most often used error-handling outcome was to ____.Group of answer choicesterminate the
iVinArrow [24]

In traditional programming, probably the most often used error-handling outcome was to terminate the program in which the offending statement occurred.

<h3>What is a traditional programming?</h3>

Traditional programming is known to be a form of manual way that one or a user makes a program.

Note that in the case above, In traditional programming, probably the most often used error-handling outcome was to terminate the program in which the offending statement occurred.

Learn more about programming from

brainly.com/question/23275071

#SPJ1

4 0
2 years ago
The ArrayList class contains a trim method that resizes the internal array to exactly the capacity. The trim method is intended
andreev551 [17]

Answer:

public void trimToSize() {

modCount++;

if (size < elementData.length) {

elementData = (size == 0)

? EMPTY_ELEMENTDATA

: Arrays.copyOf(elementData, size);

}

}

Now, the running time for copyOf() function is O(N) where N is the size/capacity of the ArrayList. Hence, the time complexity of trimToSize() function is O(N).

Hence, the running time of building an N-item ArrayList is O(N^2).

Please find the sample code below.

CODE

==================

import java.util.ArrayList;

public class Driver {

  public static void main(String[] args) throws Exception{

      int N = 100000;

      ArrayList<Integer> arr = new ArrayList<>(N);

     

      long startTime = System.currentTimeMillis();

      for(int i=0; i<N; i++) {

          arr.add(i);

          arr.trimToSize();

      }

      long endTime = System.currentTimeMillis();

      double time = (endTime - startTime)/1000;

      System.out.println("Total time taken = " + time + " seconds.");

  }

}

Explanation:

5 0
3 years ago
Which one of the following is true about employer responsibility in providing fall protection to workers? not selected A. Employ
Luda [366]

Option B is the correct answer, Employers have flexibility in choosing a fall protection system they believe will work best in a situation selected. It is the primary duty of employer to provide safety to its workers. Employers must setup a suitable protection system at workplace from falling off from overhead platforms and from elevated workstations during construction for safety of its employees.  

Further Explanation:

⦁ Employer must ensure compliance to OSHA-Fall protection in construction.

⦁ Generally, fall protection must be ensured by deploying guardrail systems at the edge of construction sites, safety systems built by nets or personal fall arrest.

⦁ OSHA requires to built fall protection system irrespective of fall distance to make sure safety conditions for workers/ employees.

Answer details:

Grade: High School

Subject: Computer Science and Technology.

Learn More:

Fall protection and compliance to OSHA rules and regulations

brainly.com/question/8910167

Employer responsibility in providing fall protection

brainly.com/question/5872956

Key Words: Fall protection, OSHA, workplace safety, guardrail systems etc.

Image of guardrail as an example is attached.

5 0
3 years ago
Read 2 more answers
which of the following is not a step of the scientific method A.identifying the problem B.making observations C. making a hypoth
dangina [55]
I believe the correct answer is choice D. Making a law.

I don't believe the scientific method says anything about making a law.

I hope this helps you and have a great day!
3 0
3 years ago
In terms of system thinking, what is process?
Talja [164]

Answer:b) The computer program that processes the data.

Explanation: In the computer system , process is the part of computer program which are responsible for performing of the processing of the data and other functions .The working of the process is associated with the program code and related activities/functions.

Other options that are mentioned in the question are incorrect because they don't describe the process correctly .Thus , the correct answer is option (b).

5 0
3 years ago
Read 2 more answers
Other questions:
  • What is a good voltage measurement on a brand new, 6 volt golf cart deep cycle battery after the first charging?
    10·1 answer
  • How to eject a flash drive from chromebook?
    6·1 answer
  • Assume the following variable definitions int a = 5, b = 12; double x = 3.4, z = 9.1. What are the values of the following expre
    7·1 answer
  • An application with which you can perform calculations on numbers and work with other data
    8·1 answer
  • Que es un vlog? Cual es la diferencia entre vloc y papgina web? ​
    7·1 answer
  • Explain what an IM is, and what is the technology shown in the accompanying figure
    7·2 answers
  • What does this function do in the code?
    5·2 answers
  • Programming in https<br>​
    5·1 answer
  • Define the term hardwar<br><br>​
    9·2 answers
  • What is the optimal number of members for an Agile team?
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!