Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

11 code files (5 header, 5 implementation, and the main.cpp files) If you already answered this question before, please have someone new answer it! Problem

image text in transcribed

image text in transcribed

image text in transcribed

11 code files (5 header, 5 implementation, and the main.cpp files)

If you already answered this question before, please have someone new answer it!

Problem Description You are in charge of programming a basic vending machine that serve five different categories of items: chips, cookies, gum, chocolates, and drinks. Each category has three different types of items. A particular item is identified by using A-E for the category and 1-3 for the item type. For example, the entry A3 indicates chips of the third type, C2 indicates gum of the second type, etc. Each item in the vending machine has a price. The following tables summarize how the vending machine is set up. Table 1 - Categories Category Category Label Chips Cookies B Gum Chocolate Drink E A D Table 1l - Item Costs Category Item Type Item Cost 1 0.75 A 2 1.00 3 1.25 1 1.00 B 2 1.25 3 1.50 1 0.50 C 2 0.75 3 1.00 1 0.85 D 2 1.00 3 1.15 1 0.50 E 2 1.00 3 1.50 Additionally, you will provide an interface for the user to use your vending machine. The user should be able to select an item in the list by providing its category and item type (e.g., B1). Once selected, the vending machine lets the user know the cost, and the user pays for the item and receives it. Spring 2021 Technical Requirements You should have one class per category available. Each class should be split into header/implementation files as we described in class o Each class should have two data members: item type and cost o The item type should be assigned at construction time o The item type cannot be changed after instantiation (no setter) o The cost of the item should be derived from its type at construction time The cost of the item cannot be changed after instantiation (no setter) O Both, item type and cost should be accessible to read (there should be getters) Each class should have two constructors O A fully parametrized constructor which ONLY takes the item type as a parameter A parameter-less constructor which uses the fully parametrized constructor and defaults to item type 1. Vour header files should have include guards Each class should have two constructors O A fully parametrized constructor which ONLY takes the item type as a parameter A parameter-less constructor which uses the fully parametrized constructor and defaults to item type 1. Your header files should have include guards The user can use your vending machine as follows o The user is asked to make a category selection (e.g, D) . If the category is wrong (e.g., R), let the user know they entered invalid category and ask them again to provide a category The user is asked to pick a selection (e.g., 2) o The program constructs an item of selected category and type If the user picked an incorrect item type (e.g., 5), change it so that it is defaulted to 1. This should be done in object's constructor. o The program shows back the user's selection and its price (obtained from the object). o The user enters an amount to pay If the amount is less than the item's price, ask the user for the remaining amount Repeat this until the user has paid the item in full If the amount is more or the same as the item's price, let the user know what their change is and proceed to the next step . If the amount is negative, let the user know that the entered value is invalid and to try again o Prompt the user letting them know the item selected has been served and a thank you message Your program does NOT need to ask for multiple selections. In other words, the user runs your program, selects an item, pays for it, and the program exits. Provide 5 screenshots showing different outputs of your program showing a thorough testing strategy Problem Description You are in charge of programming a basic vending machine that serve five different categories of items: chips, cookies, gum, chocolates, and drinks. Each category has three different types of items. A particular item is identified by using A-E for the category and 1-3 for the item type. For example, the entry A3 indicates chips of the third type, C2 indicates gum of the second type, etc. Each item in the vending machine has a price. The following tables summarize how the vending machine is set up. Table 1 - Categories Category Category Label Chips Cookies B Gum Chocolate Drink E A D Table 1l - Item Costs Category Item Type Item Cost 1 0.75 A 2 1.00 3 1.25 1 1.00 B 2 1.25 3 1.50 1 0.50 C 2 0.75 3 1.00 1 0.85 D 2 1.00 3 1.15 1 0.50 E 2 1.00 3 1.50 Additionally, you will provide an interface for the user to use your vending machine. The user should be able to select an item in the list by providing its category and item type (e.g., B1). Once selected, the vending machine lets the user know the cost, and the user pays for the item and receives it. Spring 2021 Technical Requirements You should have one class per category available. Each class should be split into header/implementation files as we described in class o Each class should have two data members: item type and cost o The item type should be assigned at construction time o The item type cannot be changed after instantiation (no setter) o The cost of the item should be derived from its type at construction time The cost of the item cannot be changed after instantiation (no setter) O Both, item type and cost should be accessible to read (there should be getters) Each class should have two constructors O A fully parametrized constructor which ONLY takes the item type as a parameter A parameter-less constructor which uses the fully parametrized constructor and defaults to item type 1. Vour header files should have include guards Each class should have two constructors O A fully parametrized constructor which ONLY takes the item type as a parameter A parameter-less constructor which uses the fully parametrized constructor and defaults to item type 1. Your header files should have include guards The user can use your vending machine as follows o The user is asked to make a category selection (e.g, D) . If the category is wrong (e.g., R), let the user know they entered invalid category and ask them again to provide a category The user is asked to pick a selection (e.g., 2) o The program constructs an item of selected category and type If the user picked an incorrect item type (e.g., 5), change it so that it is defaulted to 1. This should be done in object's constructor. o The program shows back the user's selection and its price (obtained from the object). o The user enters an amount to pay If the amount is less than the item's price, ask the user for the remaining amount Repeat this until the user has paid the item in full If the amount is more or the same as the item's price, let the user know what their change is and proceed to the next step . If the amount is negative, let the user know that the entered value is invalid and to try again o Prompt the user letting them know the item selected has been served and a thank you message Your program does NOT need to ask for multiple selections. In other words, the user runs your program, selects an item, pays for it, and the program exits. Provide 5 screenshots showing different outputs of your program showing a thorough testing strategy

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

Implementing Ai And Machine Learning For Business Optimization

Authors: Robert K Wiley

1st Edition

B0CPQJW72N, 979-8870675855

More Books

Students also viewed these Databases questions