Write code In C++ Please Grocery Shopping List (list) Given a ListItem class, complete main() using the
Question:
Write code In C++ Please
Grocery Shopping List (list)
Given a ListItem class, complete main() using the built-in list type to create a linked list called shoppingList. The program should read items from input (ending with -1), adding each item to shoppingList, and output each item in shoppingList using the PrintNodeData() function.
Ex. If the input is:
milk bread eggs waffles cereal -1
the output is:
milk bread eggs waffles cereal
Here are the contents of ListItem.h:
#ifndef LISTITEMH #define LISTITEMH #include
Here are the contents of ListItem.cpp:
#include "ListItem.h" #include
Use this as a template for your file, a1.1.cpp:
#include "ListItem.h" #include #include
Student Grades (map)
Given a map pre-filled with student names as keys and grades as values, complete main() by reading in the name of a student, outputting their original grade, and then reading in and outputting their new grade.
Ex: If the input is:
Quincy Wraight 73.1
the output is:
Quincy Wraight's original grade: 65.4 Quincy Wraight's new grade: 73.1
Use this as a template for your file, a1.2.cpp:
#include
Ticketing Service (queue)
Given main(), complete the program to add people to a queue. The program should read in a list of people's names including "You" (ending with -1), adding each person to the peopleInQueue queue. Then, remove each person from the queue until "You" is at the head of the queue. Include print statements as shown in the example below.
Ex. If the input is:
Zadie Smith Tom Sawyer You Louisa Alcott -1
the output is:
Welcome to the ticketing service... You are number 3 in the queue. Zadie Smith has purchased a ticket. You are now number 2 Tom Sawyer has purchased a ticket. You are now number 1 You can now purchase your ticket!
Use this as a template for your file, a1.3.cpp:
#include
Palindrome (deque)
A palindrome is a string that reads the same backwards and forwards. Use a deque to implement a program that tests whether a line of text is a palindrome. The program reads a line, then outputs whether the input is a palindrome or not.
Ex: If the input is:
senile felines!
the output is:
Yes, "senile felines!" is a palindrome.
Ex: If the input is:
rotostor
the output is:
No, "rotostor" is not a palindrome.
Ignore punctuation and spacing. Assume all alphabetic characters will be lowercase.
Use this as a template for your file, a1.4.cpp:
#include
Unique Random Integers (set)
Given integer inputs howMany and maxNum, generate a vector of howMany unique random integers from 0 to maxNum (exclusive).
The structure of the program is:
- main() calls UniqueRandomInts() with arguments howMany, and maxNum.
- UniqueRandomInts() returns a vector of howMany unique random integers.
- The required output is already provided in main() and PrintNums().
Complete UniqueRandomInts(), which generates random integers until howMany unique integers have been collected in vector nums.
Hint: If a generated number is new, add the number to vector nums and set alreadySeen. If the number has been seen before, increment the global variable retries and generate another random integer.
Note: For testing purposes, the random number generator is seeded with a fixed value (641) in main().
Ex: When the input is:
5 8
the output is
5 4 0 1 6 [2 retries]
(Note that your output may not match, because your system may generate different random numbers.)
Use this as a template for your file, a1.5.cpp:
#include
Income Tax Fundamentals 2013
ISBN: 9781285586618
31st Edition
Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill