Goal Practice the use of linked lists General remarks Keep all your testing code in...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Goal Practice the use of linked lists General remarks ▪ Keep all your testing code in submitted cpp files . For all the problems, ensure/add the proper memory allocation/deallocation (all instructions about memory are not necessarily mentioned in the instruction). . For all the problems, please use valgrind tool to confirm the proper memory management. Use the command: valgrind --tool-memcheck --leak-check=yes --show-reachable=yes --num-callers=20 --track-fds=yes ./01.0 where 01.o is the name of tested binary file Problem I. Linked Lists (20p) Write a program managing linked lists. Use single-linked list, forward-created. Each node describes a record info for a car. Node: int id string make int price int year Car *next // link to the next element In main () function, write a menu with the following options: 1. add car 2. remove car 5. exit - add new node to the end of the list. Automatically assign new id. - remove node, prompt for id of the car to remove • Maintain a variable, where you store id numbers, so each newly added car will automatically receive new sequential id that was not assigned to any car before. Write the list of cars during each loop execution. . • Provide proper deletion of the memory (both when option 2 is used and when option 5 is used) Sample output/operation CAR MANAGEMENT Car List: ------ Options: 1. Add car 2. Remove car 5. Exit Enter: 1 Enter make: Ford Enter price: 5000 Enter year: 2011 CAR MANAGEMENT Car List: 100 Ford Options: 1. Add car 2. Remove car 5. Exit Enter: 1 Enter make: GMC Enter price: 4500 Enter year: 2010 CAR MANAGEMENT Car List: 100 Ford 101 GMC Options: 1. Add car 2. Remove car 5. Exit Enter: 1 Enter make: Toyota Enter price: 7000 Enter year: 2013 CAR MANAGEMENT Car List: 100 Ford 101 GMC 102 Toyota Options: 1. Add car 2. Remove car 5. Exit 5000 5000 4500 5000 4500 7000 2011 2011 2010 2011 2010 2013 Enter: 2 Enter id of car to remove: 101 Goal Practice the use of linked lists General remarks ▪ Keep all your testing code in submitted cpp files . For all the problems, ensure/add the proper memory allocation/deallocation (all instructions about memory are not necessarily mentioned in the instruction). . For all the problems, please use valgrind tool to confirm the proper memory management. Use the command: valgrind --tool-memcheck --leak-check=yes --show-reachable=yes --num-callers=20 --track-fds=yes ./01.0 where 01.o is the name of tested binary file Problem I. Linked Lists (20p) Write a program managing linked lists. Use single-linked list, forward-created. Each node describes a record info for a car. Node: int id string make int price int year Car *next // link to the next element In main () function, write a menu with the following options: 1. add car 2. remove car 5. exit - add new node to the end of the list. Automatically assign new id. - remove node, prompt for id of the car to remove • Maintain a variable, where you store id numbers, so each newly added car will automatically receive new sequential id that was not assigned to any car before. Write the list of cars during each loop execution. . • Provide proper deletion of the memory (both when option 2 is used and when option 5 is used) Sample output/operation CAR MANAGEMENT Car List: ------ Options: 1. Add car 2. Remove car 5. Exit Enter: 1 Enter make: Ford Enter price: 5000 Enter year: 2011 CAR MANAGEMENT Car List: 100 Ford Options: 1. Add car 2. Remove car 5. Exit Enter: 1 Enter make: GMC Enter price: 4500 Enter year: 2010 CAR MANAGEMENT Car List: 100 Ford 101 GMC Options: 1. Add car 2. Remove car 5. Exit Enter: 1 Enter make: Toyota Enter price: 7000 Enter year: 2013 CAR MANAGEMENT Car List: 100 Ford 101 GMC 102 Toyota Options: 1. Add car 2. Remove car 5. Exit 5000 5000 4500 5000 4500 7000 2011 2011 2010 2011 2010 2013 Enter: 2 Enter id of car to remove: 101
Expert Answer:
Answer rating: 100% (QA)
The code is a program that manages linked lists of car records Each car record is stored in a node of the linked list which contains the information a... View the full answer
Related Book For
Income Tax Fundamentals 2013
ISBN: 9781285586618
31st Edition
Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill
Posted Date:
Students also viewed these programming questions
-
In governmental accounting, separate funds are created to keep track of revenues and costs for different activities. An internal service fund (ISF) accumulates the cost for services provided within...
-
Write a program that lists all files in a directory and their sizes. Mimic the routine in the online code.
-
Show that if a node in a binary search tree has two children, then its successor has no left child and its predecessor has no right child.
-
1. Find the general indefinite integral (x +x)dx 2. Find the general indefinite integral (u +4)(2u +1)du 7/4 1+cos? 0 de cos 0 3. Evaluate the integral . 4. Evaluate the integral by making the given...
-
Magpie Interior Decorators issued a 120-day, 6% note for $24,000, dated April 10, to Peel's Furniture Company on account. a. Determine the due date of the note. b. Determine the maturity value of the...
-
A particle of mass m is introduced with zero velocity at r = 0 when = 0. It slides outward through the smooth hollow tube, which is driven at the constant angular velocity 0 about a horizontal axis...
-
Perform a thorough influential analysis of the air pollution and mortality data given in Table B.15. Perform any appropriate transformations. Discuss your results. City Mort Precip Educ Nonwhite Nox...
-
Avery, Inc., manufactures two component parts for the television industry: Tvez. Annual production and sales of 50,000 units at a selling price of $48.72 per unit. Premia. Annual production and...
-
What is Debra's net worth if her assets total $40000, her gross income is $165000, her student loan debt is $70000 (she has no other debts), and her annual expenses (including taxes) total $88000?
-
A double pipe heat exchanger is made of a 6-nom sch 40 commercial steel outer pipe and a 5-nom sch 40S stainless steel inner pipe. The fluid in the annular space is cyclohexane that has a volumetric...
-
Businesses spend millions of dollars creating, promoting, and establishing a brand. Describe what brand equity is and how it affects a company's performance.
-
Indicate whether each of the following statements is true or false by writing T or F i n t he a nswer c olumn. All states prohibit all forms of gambling.
-
Indicate whether each of the following statements is true or false by writing T or F in the answer c olumn. Trademark registrations are issued by the U.S. Patent and Trademark Offi ce of the...
-
Determine the HR of a roadway culvert flooded with 50 years of expected service life designed to carry a 100-year storm.
-
Indicate whether each of the following statements is true or false by writing T or F in the answer c olumn. Ownership of a trademark is typically noted by using the letter O in a circle.
-
Indicate whether each of the following statements is true or false by writing T or F in the answer c olumn. It is illegal for a software producer to require that a user register his or her ownership...
-
You own a $16 million bond portfolio with a modified duration of 5 years. Interest rates are expected to increase by 3 basis points, or 0.03%. What is the price value of a basis point?
-
On October 1, 2021, Adoll Company acquired 2,600 shares of its $1 par value stock for $38 per share and held these shares in treasury. On March 1, 2023, Adoll resold all the treasury shares for $34...
-
Jenny earns $34,500 in 2012. Calculate the FICA tax that must be paid by: Jenny: ..............................Soc,Sec. ..................$______________...
-
Amy is a calendar-year taxpayer reporting on the cash basis. Please indicate how she should treat the following items for 2012: a. She makes a deductible contribution to an IRA on April 15,...
-
During 2012, William purchases the following capital assets for use in his catering business: New passenger automobile (September 30)........................$21,500 Baking equipment (June 30)...
-
Laura says she doesnt believe that humans were at one time chimpanzees or gorillas. Jeff says he doesnt believe it either. Explain why biologists also dont believe that humans are descended from...
-
Write a letter to Grandma telling her about drug resistance in living organisms. Explain to her why drug resistance is such a common phenomenonincluding why insects become more resistant to...
-
During a drought, the supply of seeds available to a finch population decreases. The smaller, softer seeds, which are easier to crack, are quickly eaten up. Finches with larger, stronger beaks are...
Personalized Custom Basketball With Name Or Text Gift For Fathers Day - ISBN: B08DG678QD - Free Book
Study smarter with the SolutionInn App