Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Project: Build and process a sorted linked list. As en entry-level programmer you have to be able to read, understand existing code and update it

Project: Build and process a sorted linked list. As en entry-level programmer you have to be able to read, understand existing code and update it (add new features). One of this assignments goals is to read about 500 lines of code (in three files: CountryList.h, CountryList.cpp, 22C_Hw_1.cpp), compile and run the program, understand it, and change it as required. The existing program does the following:

A. Reads data from a text file (countries.txt) and inserts them into a sorted linked list. The list is to be sorted in ascending order by the country code named code (a unique key). The Country structure has four fields:

code (C-string) such as FR

name (string) France

capital (string) Paris

population (int) 60656178

B. Prints the list as a table with four columns (header included)

C. Deletes countries: prompts the user to enter the code of the country to be deleted or QUIT to stop deleting.

D. Searches the list: prompts the user to enter the code of the country or QUIT to stop searching; searches for that country: if found, displays its data, otherwise displays some message, such as Not found

E. Destroys the list //no memory leak

YOUR TASK is to read and understand this program. Then do the following:

--> Replace the Country structure by a Country class (including setters, getters, etc.)

--> Replace the ListNode structure by a ListNode class (including setters, getters, etc.)

--> The code runs but it does not always work as expected. Find and fix as many (logical)

errors as you can. Make changes to improve the efficiency of the code.

--> Write a function to identify the country with the largest population

(you may assume it is unique).

--> Display data for the country with the largest population.

--> Write a short report (not more than one page) . In your report write what did you like about this program, what you didnt like about the program, and briefly explain what did you do to make this program better.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Readings In Database Systems

Authors: Michael Stonebraker

2nd Edition

0934613656, 9780934613651

More Books

Students also viewed these Databases questions

Question

What are the main differences between rigid and flexible pavements?

Answered: 1 week ago

Question

What is the purpose of a retaining wall, and how is it designed?

Answered: 1 week ago

Question

How do you determine the load-bearing capacity of a soil?

Answered: 1 week ago

Question

what is Edward Lemieux effect / Anomeric effect ?

Answered: 1 week ago