COP3331Lab4 Solved

$ 24.99
Category:

Description

1. Create a folder named Lab4 LastName FirstInitial (e.g. Lab4 Neal T).
2. In your folder, place a PDF file containing your answers to questions with a ♦.
4. Ensure that all programs have block comments at the very beginning (starting at the first line) in the file containing main() with your name and the program’s description. The block comment’s format should be identical to what’s provided in Figure 2-1.
5. Use single-line comments to describe your code’s functionality as needed.
6. Do not submit anything for questions with a ♣.
7. Zip the folder and submit it via Canvas.
♦ = 5 points each, ♠ = 15 points each

1. ♣ Read Chapter 9: How to work with structures and enumerations.
2. ♦ The advantage of returning a structure type from a function when compared to returning a fundamental type is that a. the function can return multiple values
b. the function can return an object
c. the function doesn’t need to include a return statement
d. all of the above
e. a and b only
3. ♦ What are the values of the enumerators in the enumeration that follows?
enum class Terms { net_30_days = 30, net_60_days, net_90_days
};
a. 30, 60, 90
b. 30, 1, 2
c. 30, 31, 32
d. 30, 0, 1
4. ♣ Read Chapter 10: How to work with STL containers and iterators.
5. ♦ What are the values of the elements in the vector named names 1 after the following code is executed?
vector<string> names_1 { “Mike”, “Ben”, “Joel”, “Anne” }; vector<string> names_2 { “Judy”, “Samantha”, “Kelly” };
names_1.insert(names_1.end(), “Mary”); names_1.erase(names_1.begin()); names_1.insert(names_1.begin() + 2, ++names_2.begin(), names_2.end()); names_1.swap(names_2); names_1.erase(++names_1.begin()); names_1.insert(names_1.begin(), ++names_2.begin(), names_2.begin() + 2);
a. Joel, Judy, Kelly
b. Judy, Mary, Joel, Mary
c. Joel, Judy, Samantha
d. Joel, Anne, Judy, Samantha
6. ♦ When you dereference an iterator, you
a. set the value of the iterator variable to null
b. set the iterator so it points one memory location past the last element in the container
c. get the value of the element that the iterator points to
d. get the memory address of the element that the iterator points to
7. ♠ Program Champion Counter
Create a program that reads a text file that contains a list of FIFA World Cup champions and determines the country that has won the most championships. Place your solution in folder lab4-q7 for submission.
Console
FIFA World Cup Winners
Country Wins Years
======= ==== =====
Argentina 2 1978, 1986
Brazil 5 1958, 1962, 1970, 1994, 2002
England 1 1966
Germany 4 1954, 1974, 1990, 2014
Italy 4 1934, 1938, 1982, 2006
Spain 1 2010
Uruguay 2 1930, 1950
Specifications
• You have been provided a text file named world cup champions.txt that contains data like this:
Year Country Coach Captain
1930 Uruguay Alberto Suppici Jos´e Nasazzi
1934 Italy Vittorio Pozzo Gianpiero Combi
1938 Italy Vittorio Pozzo Giuseppe Meazza
1950 Uruguay Juan L´opez Obdulio Varela
1954 Germany Sepp Herberger Fritz Walter
1958 Brazil Vicente Feola Hilderaldo Bellini
1962 Brazil Aymor´e Moreira Mauro Ramos
1966 England Alf Ramsey Bobby Moore
1970 Brazil M´ario Zagallo Carlos Alberto
1974 Germany Helmut Sch¨on Franz Beckenbauer
1978 Argentina C´esar Luis Menotti Daniel Passarella
1982 Italy Enzo Bearzot Dino Zoff
1986 Argentina Carlos Bilardo Diego Maradona
1990 Germany Franz Beckenbauer Lothar Matth¨aus
1994 Brazil Carlos Alberto Parreira Dunga
1998 France Aim´e Jacquet Didier Deschamps
2002 Brazil Luiz Felipe Scolari Cafu
2006 Italy Marcello Lippi Fabio Cannavaro
2010 Spain Vicente del Bosque Iker Casillas
2014 Germany Joachim L¨ow Philipp Lahm
• When the program starts, it should read the text file and use a map to store the required data using the name of each country as the key.
• The program should display the countries in alphabetical order.

Reviews

There are no reviews yet.

Be the first to review “COP3331Lab4 Solved”

Your email address will not be published. Required fields are marked *