Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Problem B: Grocery checkout (20 points) Start with the checkout.cpp file provided. You must make a class that works with the existing main0 function that

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

Problem B: Grocery checkout (20 points) Start with the checkout.cpp file provided. You must make a class that works with the existing main0 function that simulates checking out at a grocery store. You may assume fewer than 200 items will be checked out. Ensure that you class makes the provided main output match the examples exactly 0 1. The add0 function should add a checkout item to the items being bought, either increasing the amount by one if the item is already present or adding it to the list if it is new. 2. You may directly compare strings when adding, thus if the string is different at all it can be treated as a new item (so apples are not Apples) 3. The checkout0 function should return a list of all items and their quantities, along with a final additional line saying how many items were bought. 4. Note that the item bought is the sum of the quantities, not the amount of different types of items on the list. The order that you display the items is not important (but the order the examples use is probably the easiest to do). [Hint: A easy way to get numbers into string is to use the overloaded operator for strings along with the int2str0 function provided, for example string x x int str (2) x x Apples cout x; shows "2x Apples" Example 1 (user input is underlined) apple banana apple checkout Receipt 2x apple 1x banana Problem B: Grocery checkout (20 points) Start with the checkout.cpp file provided. You must make a class that works with the existing main0 function that simulates checking out at a grocery store. You may assume fewer than 200 items will be checked out. Ensure that you class makes the provided main output match the examples exactly 0 1. The add0 function should add a checkout item to the items being bought, either increasing the amount by one if the item is already present or adding it to the list if it is new. 2. You may directly compare strings when adding, thus if the string is different at all it can be treated as a new item (so apples are not Apples) 3. The checkout0 function should return a list of all items and their quantities, along with a final additional line saying how many items were bought. 4. Note that the item bought is the sum of the quantities, not the amount of different types of items on the list. The order that you display the items is not important (but the order the examples use is probably the easiest to do). [Hint: A easy way to get numbers into string is to use the overloaded operator for strings along with the int2str0 function provided, for example string x x int str (2) x x Apples cout x; shows "2x Apples" Example 1 (user input is underlined) apple banana apple checkout Receipt 2x apple 1x banana

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

Step: 3

blur-text-image

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

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2017 Skopje Macedonia September 18 22 2017 Proceedings Part 3 Lnai 10536

Authors: Yasemin Altun ,Kamalika Das ,Taneli Mielikainen ,Donato Malerba ,Jerzy Stefanowski ,Jesse Read ,Marinka Zitnik ,Michelangelo Ceci ,Saso Dzeroski

1st Edition

ISBN: 3319712721, 978-3319712727

More Books

Students also viewed these Databases questions

Question

1. Who should participate and how will participants be recruited?

Answered: 1 week ago