100a 22 4 451a 1034 51b 1000 101c 1100 11d 1123 201e 1 ✓ Solved

100A A B C D E A B C D E F G B A B C C A B C A B C D D A B C chocolate chips candy bar cookies brownie protein bar coke can 6 oz coke bottle diet coke can diet coke bottle oz orange juice oz orange juice apple juice gatorade regular coffee large coffee decaff coffee hot chocolate latte cappuccino ham sandwich egg sandwich tuna sandwich healthy salad CSCI 140 -- Project 4 (Vending Machine System II) Must present and turn in Tuesday, 06/04/2019 (TTh Section) Must present and turn in Monday, 06/03/2019 (MW Section) Problem Statement A company intends to build a vending machine system and it wants you to develop a customized object-oriented software for its system. This company currently has plan for four different models (100A, 100B, 100C, and 100D) and it is planning to add several more in the future.

A customer can utilize one or more models by setting up an approriate data file. Each machine shall be able to keep track of its inventory, money (if applicable), and transactions. Inventory for each system shall consist of a list of product items and a quantity for each. Money for each system shall consist of number of nickels, dimes, quarters, and dollar bills if applicable (no pennies). We will assume that the cost for each item is a multiple of 5 cents.

Model 100A accepts one-dollar bill only and it give back changes using coins as well as utilizing a lower denomination if needed (similar to project 1 and you can ignore special case like Q = 2, D = 4, N = 0, and you need to give back 55 cents). Model 100B accepts coins and one-dollar bills, but it returns changes in coins only and it utilizes lower denomination including special case like Q = 2, D = 4, N = 0, and you need to give back 55 cents if needed (similar to project 1 with extra credit 1 and 2). Model 100C accepts credit card payment only and it automatically rejects a purchase after two invalid credit card entries. See below for requirements in validation a credit card. Model 100D accepts both coins (like 100A) and credit card (like 100C).

In general, an invalid transaction will not be processed and money will be returned if applicable. You are required to provide an implementation for model 100A, model 100B, and model 100C. All Credit Card numbers follow certain patterns. A credit card must have between 13 and 16 digits and it must start with a 4, 5, 37, or 6. In 1954, Hans Luhn of IBM proposed an algorithm for validating credit card numbers.

This algorithm is useful to determine if a card number is entered correctly or if a credit card is scanned correctly by a scanner. Almost all credit card numbers are generated following this validity check, which can be described as follows: 1. Double every second digit from right to left. If doubling of a digit results in a two- digit number, add up the two digits to get a single-digit number. For example, if a particular second digit were 4, then computing that digit would be 4 x 2 = 8.

If a particular second digit were 6, then computing that digit would be 6 x 2 = 12 → 1 + 2 = 3. 2. Now add all single-digit number from Step 1. 3. Add all digits in the odd places from right to left in the card number.

4. Sum the result from Step 2 and Step 3. 5. If the result from Step 4 is divisible by 10, the card number is valid. If the result from Step 4 is not divisible by 10, it is invalid.

You must use Luhn’s algorithm to determine if the Credit Card number is valid or not. • Example valid Credit Card number: • Example invalid Credit Card number: • Try your own credit card! The vending machine system will load all machines with data from input data files (machines.txt and products.txt) upon a secret code of “spring19†is entered by an operator. Once an operator initiates the system with a special code, customers will be able to make a purchase by selecting a machine first, selects an item, and then enters a purchase amount. After the system is in use and after a correct secret code is entered, the system will generate a detailed report for each machine in an output file, reports.txt, and then shuts down all machines.

See below for a sample input/output for models 100A and 100C and you should follow similar interface for models 100B and 100D. Do not include models that your system cannot support at this time. Please enter a startup code --> spring19<E> Initialize machines. Please wait ... Machines are ready.

Available machines: 100A1, 100A2, 100B1, 100C1, 100C2 Select a machine --> 100A1<E> This machine accepts one-dollar bill only. Available items: 1A 50 candy bar 1B 35 chocolate chips 1C 75 cookies 1D 60 brownie 1E 165 protein bar Select an item --> 1B<E> You selected “chocolate chipsâ€. The cost of this item is 35 cents. Insert your money --> 100 0<E> You entered an amount of 100 cents. Processing your purchase ...

Your change of 65 cents is given as: quarter(s): 2 dime(s): 1 nickel(s): 1 Thank you! Please take your item. Select a machine --> 100A1<E> This machine accepts one-dollar bill only. Available items: 1A 50 candy bar 1B 35 chocolate chips 1C 75 cookies 1D 60 brownie 1E 165 protein bar Select an item --> 1B<E> You selected “chocolate chipsâ€. The cost of this item is 35 cents.

Insert your money --> 100 0<E> You entered an amount of 100 cents. Processing your purchase ... Insufficient changes! Your transaction cannot be processed. Please take back your dollar bill.

Select a machine --> 100A1<E> This machine accepts one-dollar bill only. Available items: 1A 50 candy bar 1B 35 chocolate chips 1C 75 cookies 1D 60 brownie 1E 165 protein bar Select an item --> 1C You selected “cookiesâ€. The cost of this item is 75 cents. Insert your money --> 100 0<E> You entered an amount of 100 cents. Processing your purchase ...

Your change of 25 cents is given as: quarter(s): 0 dime(s): 2 nickel(s): 1 Thank you! Please take your item. Select a machine --> 100A1<E> This machine accepts one-dollar bill only. Available items: 1A 50 candy bar 1B 35 chocolate chips 1D 60 brownie 1E 165 protein bar Select an item --> 1B<E> You selected “chocolate chipsâ€. The cost of this item is 35 cents.

Insert your money --> 0<E> You chose to cancel your selection. Select a machine --> 100C1<E> This machine accepts credit card only. Available items: 1A 300 ham sandwich 1B 275 egg sandwich 1C 325 tuna sandwich Select an item --> 1B You selected “egg sandwichâ€. The cost of this item is 275 cents. Enter your credit card number --> <E> Invalid credit card number was entered.

Enter your credit card number --> <E> Your credit card was successfully charged for

100a 22 4 451a 1034 51b 1000 101c 1100 11d 1123 201e 1

100A A B C D E A B C D E F G B A B C C A B C A B C D D A B C chocolate chips candy bar cookies brownie protein bar coke can 6 oz coke bottle diet coke can diet coke bottle oz orange juice oz orange juice apple juice gatorade regular coffee large coffee decaff coffee hot chocolate latte cappuccino ham sandwich egg sandwich tuna sandwich healthy salad CSCI 140 -- Project 4 (Vending Machine System II) Must present and turn in Tuesday, 06/04/2019 (TTh Section) Must present and turn in Monday, 06/03/2019 (MW Section) Problem Statement A company intends to build a vending machine system and it wants you to develop a customized object-oriented software for its system. This company currently has plan for four different models (100A, 100B, 100C, and 100D) and it is planning to add several more in the future.

A customer can utilize one or more models by setting up an approriate data file. Each machine shall be able to keep track of its inventory, money (if applicable), and transactions. Inventory for each system shall consist of a list of product items and a quantity for each. Money for each system shall consist of number of nickels, dimes, quarters, and dollar bills if applicable (no pennies). We will assume that the cost for each item is a multiple of 5 cents.

Model 100A accepts one-dollar bill only and it give back changes using coins as well as utilizing a lower denomination if needed (similar to project 1 and you can ignore special case like Q = 2, D = 4, N = 0, and you need to give back 55 cents). Model 100B accepts coins and one-dollar bills, but it returns changes in coins only and it utilizes lower denomination including special case like Q = 2, D = 4, N = 0, and you need to give back 55 cents if needed (similar to project 1 with extra credit 1 and 2). Model 100C accepts credit card payment only and it automatically rejects a purchase after two invalid credit card entries. See below for requirements in validation a credit card. Model 100D accepts both coins (like 100A) and credit card (like 100C).

In general, an invalid transaction will not be processed and money will be returned if applicable. You are required to provide an implementation for model 100A, model 100B, and model 100C. All Credit Card numbers follow certain patterns. A credit card must have between 13 and 16 digits and it must start with a 4, 5, 37, or 6. In 1954, Hans Luhn of IBM proposed an algorithm for validating credit card numbers.

This algorithm is useful to determine if a card number is entered correctly or if a credit card is scanned correctly by a scanner. Almost all credit card numbers are generated following this validity check, which can be described as follows: 1. Double every second digit from right to left. If doubling of a digit results in a two- digit number, add up the two digits to get a single-digit number. For example, if a particular second digit were 4, then computing that digit would be 4 x 2 = 8.

If a particular second digit were 6, then computing that digit would be 6 x 2 = 12 → 1 + 2 = 3. 2. Now add all single-digit number from Step 1. 3. Add all digits in the odd places from right to left in the card number.

4. Sum the result from Step 2 and Step 3. 5. If the result from Step 4 is divisible by 10, the card number is valid. If the result from Step 4 is not divisible by 10, it is invalid.

You must use Luhn’s algorithm to determine if the Credit Card number is valid or not. • Example valid Credit Card number: • Example invalid Credit Card number: • Try your own credit card! The vending machine system will load all machines with data from input data files (machines.txt and products.txt) upon a secret code of “spring19†is entered by an operator. Once an operator initiates the system with a special code, customers will be able to make a purchase by selecting a machine first, selects an item, and then enters a purchase amount. After the system is in use and after a correct secret code is entered, the system will generate a detailed report for each machine in an output file, reports.txt, and then shuts down all machines.

See below for a sample input/output for models 100A and 100C and you should follow similar interface for models 100B and 100D. Do not include models that your system cannot support at this time. Please enter a startup code --> spring19<E> Initialize machines. Please wait ... Machines are ready.

Available machines: 100A1, 100A2, 100B1, 100C1, 100C2 Select a machine --> 100A1<E> This machine accepts one-dollar bill only. Available items: 1A 50 candy bar 1B 35 chocolate chips 1C 75 cookies 1D 60 brownie 1E 165 protein bar Select an item --> 1B<E> You selected “chocolate chipsâ€. The cost of this item is 35 cents. Insert your money --> 100 0<E> You entered an amount of 100 cents. Processing your purchase ...

Your change of 65 cents is given as: quarter(s): 2 dime(s): 1 nickel(s): 1 Thank you! Please take your item. Select a machine --> 100A1<E> This machine accepts one-dollar bill only. Available items: 1A 50 candy bar 1B 35 chocolate chips 1C 75 cookies 1D 60 brownie 1E 165 protein bar Select an item --> 1B<E> You selected “chocolate chipsâ€. The cost of this item is 35 cents.

Insert your money --> 100 0<E> You entered an amount of 100 cents. Processing your purchase ... Insufficient changes! Your transaction cannot be processed. Please take back your dollar bill.

Select a machine --> 100A1<E> This machine accepts one-dollar bill only. Available items: 1A 50 candy bar 1B 35 chocolate chips 1C 75 cookies 1D 60 brownie 1E 165 protein bar Select an item --> 1C You selected “cookiesâ€. The cost of this item is 75 cents. Insert your money --> 100 0<E> You entered an amount of 100 cents. Processing your purchase ...

Your change of 25 cents is given as: quarter(s): 0 dime(s): 2 nickel(s): 1 Thank you! Please take your item. Select a machine --> 100A1<E> This machine accepts one-dollar bill only. Available items: 1A 50 candy bar 1B 35 chocolate chips 1D 60 brownie 1E 165 protein bar Select an item --> 1B<E> You selected “chocolate chipsâ€. The cost of this item is 35 cents.

Insert your money --> 0<E> You chose to cancel your selection. Select a machine --> 100C1<E> This machine accepts credit card only. Available items: 1A 300 ham sandwich 1B 275 egg sandwich 1C 325 tuna sandwich Select an item --> 1B You selected “egg sandwichâ€. The cost of this item is 275 cents. Enter your credit card number --> <E> Invalid credit card number was entered.

Enter your credit card number --> <E> Your credit card was successfully charged for $2.75. Thank you! Please take your item. Select a machine --> 100B1<E> This machine accepts coins or one-dollar bill. Available items: 1A 80 coke bottle 1B 45 coke can 6 oz 1C 80 diet coke bottle Select an item --> 1C<E> You selected “diet coke bottleâ€.

The cost of this item is 80 cents. Select an option (1 - dollar bill and 2 - coins) --> 2<Enter> Please insert your coins --> <Enter> You inserted an amount of 85 cents. Processing your purchase ... Your change of 5 cents is given as: quarter(s): 0 dime(s): 0 nickel(s): 1 Thank you! Please take your item.

Select a machine --> 100B1<E> This machine accepts coins or one-dollar bill. Available items: 1A 80 coke bottle 1B 45 coke can 6 oz 1C 80 diet coke bottle Select an item --> 1B<E> You selected “coke can 6 ozâ€. The cost of this item is 45 cents. Select an option (1 - dollar bill and 2 - coins) --> 1<Enter> Insert your money --> 100 0<E> You entered an amount of 100 cents. Processing your purchase ...

Your change of 55 cents is given as: quarter(s): 1 dime(s): 3 nickel(s): 0 Thank you! Please take your item. Select a machine --> 100C2<E> This machine accepts credit card only. Available items: 1A 300 ham sandwich 1C 325 tuna sandwich 1D 200 healthy salad Select an item --> 1D You selected “healthy saladâ€. The cost of this item is 200 cents.

Enter your credit card number --> <E> Invalid credit card number was entered. Enter your credit card number --> <E> Invalid credit card number was entered. Too many invalid attempts. Your selection is cancelled. Select a machine --> spring19<E> Report is generating ...

System is shutting down. Sample report for machinesOutput.txt (processed machines for test cases above, but you need to print all available machines): Machine: 100A1 Initial balance: $1.10 (0 $, 2 Q, 4 D, 4 N) Number of valid transactions: 2 Total cost: $1.10 Current balance: $2.20 (2 $, 0 Q, 1 D, 2 N) Machine inventory: Code Id Description Initial Current 1A 1034 candy bar B 1000 chocolate chips C 1100 cookies D 1123 brownie E 1222 protein bar 5 5 Machine: 100B1 Initial balance: $0.95 (0 $, 2 Q, 4 D, 1 N) Number of valid transactions: 2 Total cost: $1.30 Current balance: $2.20 (1 $, 4 Q, 2 D, 0 N) Machine inventory: Code Id Description Initial Current 1A 2180 coke bottle B 1283 coke can 6 oz C 3629 diet coke bottle 5 4 Machine: 100C1 Initial balance: $0.00 (0 $, 0 Q, 0 D, 0 N) Number of valid transactions: 1 Total cost: $2.75 Current balance: $2.75 (0 $, 0 Q, 0 D, 0 N) Machine inventory: Code Id Description Initial Current 1A 6774 ham sandwich B 6869 egg sandwich C 6879 tuna sandwich 2 2 Machine: 100C2 Initial balance: $0.00 (0 $, 0 Q, 0 D, 0 N) Number of valid transactions: 0 Total cost: $0.00 Current balance: $0.00 (0 $, 0 Q, 0 D, 0 N) Machine inventory: Code Id Description Initial Current 1A 6774 ham sandwich B 6869 egg sandwich C 6879 tuna sandwich D 6879 Healthy salad 10 10 There will be a data file, machines.txt, contains information about the number of machines, model, money, and available items.

Another data file, products.txt, contains all product items to be loaded in the machines. We will also make these assumptions as well: • Each product item consists of an id, description, and price. • A purchase amount will be entered as a list of denominations and terminates by a sentinel value of 0 (e.g., or 100 0 or ). • An amount of 0 (for money) or 2 invalid attempts (credit card) will cancel an item selection. • An invalid denomination being entered will be ignored. • The input data files contain valid data, but it there might not be enough items to fill all machines at start up (e.g., there are only 3 cookies, but 5 cookies are needed; fill machine with 3). • Start up all available machines at the same time. • Shut down all machines at the same time.

Analysis and Design Make sure you understand all the requirements. Ask for clarifications and missing information before you move on to the design phase. Select an additional model that you are going to implement. It must be an object-oriented system and make sure to take advantage of composition and inheritance in your design. Draw a UML class diagram showing both has-a and is-a relationships as applicable.

Include as much attributes and behaviors as you can for each class. Feel free to use pseudocode to document some complex behaviors. You may want to design the layout of the report as well. Implementation Write a vending machine application by putting those classes together. The program first loads data from products.txt and machines.txt (should work with other data files as long as they follow the same format – more products and/or more machines).

It then allows customers to make purchases. Print helpful messages to the screen so that we know what is going on. You should be able to utilize polymorphism so that you will not need to do unnecessary work (hint: an array/vector of generic machine objects and you can write code like machines[i].purchase()). Incorporate as many useful OOP feature as you can and points will be deducted if you do not utilizing at least some useful OOP features (e.g., const member functions, composition and aggregation, inheritance, operator overloading, etc.). You might not be able to finish the whole project so you should prioritize your features as follow: 1.

Input data from the two files (machines.txt and products.txt) – can start with testMachineA.txt or testMachineC.txt instead of machines.txt 2. Support one machine for one model such as model 100A or 100C 3. Support multiple machines for one model and other models – can work with machines.txt (read and ignore data for unimplemented models) 4. Output report to a file Team project: It is not required but it is highly recommended that you work in a team of two or three people since there will be lots of work for one person. You must sign up by a specified deadline if it is going to be a team project (MW section -- Wednesday, 05/15/19; TTh section -- Thursday, 05/16/19).

Make sure to split the responsibilities equally and work together (each person on the team should be responsible for one or more classes). You do need to provide a short description on who did what and your experience as a team project. If there are features that you like to add to your application, let me know ahead of time. Project presentation: Each team must do a short presentation about your project (including a 1-person team) or points will be deducted. It will be around 10 minutes and you need to discuss status, show your design (UML class diagram), demonstrate the program (running specified test cases), and answer questions.

Extra credit: You can earn up to 6 additional points for two of the following (each feature is worth 3 points): • Fully utilizing OOP approach – minimal main() with well-defined related classes, good use of has-a and is-a relationships (3 points) • Implementation of model 100D (3 points) • Refill machine -- add more coins and product items to a machine (3 points) • Purchase multiple items in one transaction (3 points) • Pre-approved additional feature (3 points) – propose and ask for approval Bonus points: The best overall project will earn an extra 6 points, the second best overall project will earn an extra 4 points, and the third best overall project will earn an extra 2 points. It will be based on the following with 1 being the most important: 1.

Fully implementation of required features 2. Good utilization of OOP 3. Your program is robust and easy to use (input validation and helpful output) 4. Good presentation/demonstration by the whole team (handout, PowerPoint, planned test cases/scenarios, etc.) 5. Work well as a team Please provide documentation and applying good coding style because it is part of the grade.

Use the provided template as the starting point. You must come up with a sufficient number of test cases since the test cases are also part of the grade. Please submit the following items in a folder if flash drive is included for each team (can also submit source code ahead of time via Canvas and a folder is not needed). You can also submit just a hardcopy of the title page and remaining items electronically via Canvas (a PDF file of all printouts and actual source files in a .zip file). Each team only needs to submit one set of project submission.

1. Title page with name, class, project number, and relevant information about your program (compiler and system used, file names). 2. Status and team information (if applicable). Clearly document extra features and missing features if applicable.

3. Design documentation – UML class diagram and pseudocode if applicable. 4. Printouts of any input/output. Include the test cases on project sheet.

5. A printout of the source code. 6. A copy of source code on a flash drive or Canvas -- source code (.h and .cpp files in a .zip file). Your program will be graded as follow: • Correctness/Efficiency: 40 points • Test Cases: 5 points • Documentation/Coding Style: 10 points • Presentation: 5 points © by T. Vo

.75. Thank you! Please take your item. Select a machine --> 100B1<E> This machine accepts coins or one-dollar bill. Available items: 1A 80 coke bottle 1B 45 coke can 6 oz 1C 80 diet coke bottle Select an item --> 1C<E> You selected “diet coke bottleâ€.

The cost of this item is 80 cents. Select an option (1 - dollar bill and 2 - coins) --> 2<Enter> Please insert your coins --> <Enter> You inserted an amount of 85 cents. Processing your purchase ... Your change of 5 cents is given as: quarter(s): 0 dime(s): 0 nickel(s): 1 Thank you! Please take your item.

Select a machine --> 100B1<E> This machine accepts coins or one-dollar bill. Available items: 1A 80 coke bottle 1B 45 coke can 6 oz 1C 80 diet coke bottle Select an item --> 1B<E> You selected “coke can 6 ozâ€. The cost of this item is 45 cents. Select an option (1 - dollar bill and 2 - coins) --> 1<Enter> Insert your money --> 100 0<E> You entered an amount of 100 cents. Processing your purchase ...

Your change of 55 cents is given as: quarter(s): 1 dime(s): 3 nickel(s): 0 Thank you! Please take your item. Select a machine --> 100C2<E> This machine accepts credit card only. Available items: 1A 300 ham sandwich 1C 325 tuna sandwich 1D 200 healthy salad Select an item --> 1D You selected “healthy saladâ€. The cost of this item is 200 cents.

Enter your credit card number --> <E> Invalid credit card number was entered. Enter your credit card number --> <E> Invalid credit card number was entered. Too many invalid attempts. Your selection is cancelled. Select a machine --> spring19<E> Report is generating ...

System is shutting down. Sample report for machinesOutput.txt (processed machines for test cases above, but you need to print all available machines): Machine: 100A1 Initial balance: .10 (0 $, 2 Q, 4 D, 4 N) Number of valid transactions: 2 Total cost: .10 Current balance:

100a 22 4 451a 1034 51b 1000 101c 1100 11d 1123 201e 1

100A A B C D E A B C D E F G B A B C C A B C A B C D D A B C chocolate chips candy bar cookies brownie protein bar coke can 6 oz coke bottle diet coke can diet coke bottle oz orange juice oz orange juice apple juice gatorade regular coffee large coffee decaff coffee hot chocolate latte cappuccino ham sandwich egg sandwich tuna sandwich healthy salad CSCI 140 -- Project 4 (Vending Machine System II) Must present and turn in Tuesday, 06/04/2019 (TTh Section) Must present and turn in Monday, 06/03/2019 (MW Section) Problem Statement A company intends to build a vending machine system and it wants you to develop a customized object-oriented software for its system. This company currently has plan for four different models (100A, 100B, 100C, and 100D) and it is planning to add several more in the future.

A customer can utilize one or more models by setting up an approriate data file. Each machine shall be able to keep track of its inventory, money (if applicable), and transactions. Inventory for each system shall consist of a list of product items and a quantity for each. Money for each system shall consist of number of nickels, dimes, quarters, and dollar bills if applicable (no pennies). We will assume that the cost for each item is a multiple of 5 cents.

Model 100A accepts one-dollar bill only and it give back changes using coins as well as utilizing a lower denomination if needed (similar to project 1 and you can ignore special case like Q = 2, D = 4, N = 0, and you need to give back 55 cents). Model 100B accepts coins and one-dollar bills, but it returns changes in coins only and it utilizes lower denomination including special case like Q = 2, D = 4, N = 0, and you need to give back 55 cents if needed (similar to project 1 with extra credit 1 and 2). Model 100C accepts credit card payment only and it automatically rejects a purchase after two invalid credit card entries. See below for requirements in validation a credit card. Model 100D accepts both coins (like 100A) and credit card (like 100C).

In general, an invalid transaction will not be processed and money will be returned if applicable. You are required to provide an implementation for model 100A, model 100B, and model 100C. All Credit Card numbers follow certain patterns. A credit card must have between 13 and 16 digits and it must start with a 4, 5, 37, or 6. In 1954, Hans Luhn of IBM proposed an algorithm for validating credit card numbers.

This algorithm is useful to determine if a card number is entered correctly or if a credit card is scanned correctly by a scanner. Almost all credit card numbers are generated following this validity check, which can be described as follows: 1. Double every second digit from right to left. If doubling of a digit results in a two- digit number, add up the two digits to get a single-digit number. For example, if a particular second digit were 4, then computing that digit would be 4 x 2 = 8.

If a particular second digit were 6, then computing that digit would be 6 x 2 = 12 → 1 + 2 = 3. 2. Now add all single-digit number from Step 1. 3. Add all digits in the odd places from right to left in the card number.

4. Sum the result from Step 2 and Step 3. 5. If the result from Step 4 is divisible by 10, the card number is valid. If the result from Step 4 is not divisible by 10, it is invalid.

You must use Luhn’s algorithm to determine if the Credit Card number is valid or not. • Example valid Credit Card number: • Example invalid Credit Card number: • Try your own credit card! The vending machine system will load all machines with data from input data files (machines.txt and products.txt) upon a secret code of “spring19†is entered by an operator. Once an operator initiates the system with a special code, customers will be able to make a purchase by selecting a machine first, selects an item, and then enters a purchase amount. After the system is in use and after a correct secret code is entered, the system will generate a detailed report for each machine in an output file, reports.txt, and then shuts down all machines.

See below for a sample input/output for models 100A and 100C and you should follow similar interface for models 100B and 100D. Do not include models that your system cannot support at this time. Please enter a startup code --> spring19<E> Initialize machines. Please wait ... Machines are ready.

Available machines: 100A1, 100A2, 100B1, 100C1, 100C2 Select a machine --> 100A1<E> This machine accepts one-dollar bill only. Available items: 1A 50 candy bar 1B 35 chocolate chips 1C 75 cookies 1D 60 brownie 1E 165 protein bar Select an item --> 1B<E> You selected “chocolate chipsâ€. The cost of this item is 35 cents. Insert your money --> 100 0<E> You entered an amount of 100 cents. Processing your purchase ...

Your change of 65 cents is given as: quarter(s): 2 dime(s): 1 nickel(s): 1 Thank you! Please take your item. Select a machine --> 100A1<E> This machine accepts one-dollar bill only. Available items: 1A 50 candy bar 1B 35 chocolate chips 1C 75 cookies 1D 60 brownie 1E 165 protein bar Select an item --> 1B<E> You selected “chocolate chipsâ€. The cost of this item is 35 cents.

Insert your money --> 100 0<E> You entered an amount of 100 cents. Processing your purchase ... Insufficient changes! Your transaction cannot be processed. Please take back your dollar bill.

Select a machine --> 100A1<E> This machine accepts one-dollar bill only. Available items: 1A 50 candy bar 1B 35 chocolate chips 1C 75 cookies 1D 60 brownie 1E 165 protein bar Select an item --> 1C You selected “cookiesâ€. The cost of this item is 75 cents. Insert your money --> 100 0<E> You entered an amount of 100 cents. Processing your purchase ...

Your change of 25 cents is given as: quarter(s): 0 dime(s): 2 nickel(s): 1 Thank you! Please take your item. Select a machine --> 100A1<E> This machine accepts one-dollar bill only. Available items: 1A 50 candy bar 1B 35 chocolate chips 1D 60 brownie 1E 165 protein bar Select an item --> 1B<E> You selected “chocolate chipsâ€. The cost of this item is 35 cents.

Insert your money --> 0<E> You chose to cancel your selection. Select a machine --> 100C1<E> This machine accepts credit card only. Available items: 1A 300 ham sandwich 1B 275 egg sandwich 1C 325 tuna sandwich Select an item --> 1B You selected “egg sandwichâ€. The cost of this item is 275 cents. Enter your credit card number --> <E> Invalid credit card number was entered.

Enter your credit card number --> <E> Your credit card was successfully charged for $2.75. Thank you! Please take your item. Select a machine --> 100B1<E> This machine accepts coins or one-dollar bill. Available items: 1A 80 coke bottle 1B 45 coke can 6 oz 1C 80 diet coke bottle Select an item --> 1C<E> You selected “diet coke bottleâ€.

The cost of this item is 80 cents. Select an option (1 - dollar bill and 2 - coins) --> 2<Enter> Please insert your coins --> <Enter> You inserted an amount of 85 cents. Processing your purchase ... Your change of 5 cents is given as: quarter(s): 0 dime(s): 0 nickel(s): 1 Thank you! Please take your item.

Select a machine --> 100B1<E> This machine accepts coins or one-dollar bill. Available items: 1A 80 coke bottle 1B 45 coke can 6 oz 1C 80 diet coke bottle Select an item --> 1B<E> You selected “coke can 6 ozâ€. The cost of this item is 45 cents. Select an option (1 - dollar bill and 2 - coins) --> 1<Enter> Insert your money --> 100 0<E> You entered an amount of 100 cents. Processing your purchase ...

Your change of 55 cents is given as: quarter(s): 1 dime(s): 3 nickel(s): 0 Thank you! Please take your item. Select a machine --> 100C2<E> This machine accepts credit card only. Available items: 1A 300 ham sandwich 1C 325 tuna sandwich 1D 200 healthy salad Select an item --> 1D You selected “healthy saladâ€. The cost of this item is 200 cents.

Enter your credit card number --> <E> Invalid credit card number was entered. Enter your credit card number --> <E> Invalid credit card number was entered. Too many invalid attempts. Your selection is cancelled. Select a machine --> spring19<E> Report is generating ...

System is shutting down. Sample report for machinesOutput.txt (processed machines for test cases above, but you need to print all available machines): Machine: 100A1 Initial balance: $1.10 (0 $, 2 Q, 4 D, 4 N) Number of valid transactions: 2 Total cost: $1.10 Current balance: $2.20 (2 $, 0 Q, 1 D, 2 N) Machine inventory: Code Id Description Initial Current 1A 1034 candy bar B 1000 chocolate chips C 1100 cookies D 1123 brownie E 1222 protein bar 5 5 Machine: 100B1 Initial balance: $0.95 (0 $, 2 Q, 4 D, 1 N) Number of valid transactions: 2 Total cost: $1.30 Current balance: $2.20 (1 $, 4 Q, 2 D, 0 N) Machine inventory: Code Id Description Initial Current 1A 2180 coke bottle B 1283 coke can 6 oz C 3629 diet coke bottle 5 4 Machine: 100C1 Initial balance: $0.00 (0 $, 0 Q, 0 D, 0 N) Number of valid transactions: 1 Total cost: $2.75 Current balance: $2.75 (0 $, 0 Q, 0 D, 0 N) Machine inventory: Code Id Description Initial Current 1A 6774 ham sandwich B 6869 egg sandwich C 6879 tuna sandwich 2 2 Machine: 100C2 Initial balance: $0.00 (0 $, 0 Q, 0 D, 0 N) Number of valid transactions: 0 Total cost: $0.00 Current balance: $0.00 (0 $, 0 Q, 0 D, 0 N) Machine inventory: Code Id Description Initial Current 1A 6774 ham sandwich B 6869 egg sandwich C 6879 tuna sandwich D 6879 Healthy salad 10 10 There will be a data file, machines.txt, contains information about the number of machines, model, money, and available items.

Another data file, products.txt, contains all product items to be loaded in the machines. We will also make these assumptions as well: • Each product item consists of an id, description, and price. • A purchase amount will be entered as a list of denominations and terminates by a sentinel value of 0 (e.g., or 100 0 or ). • An amount of 0 (for money) or 2 invalid attempts (credit card) will cancel an item selection. • An invalid denomination being entered will be ignored. • The input data files contain valid data, but it there might not be enough items to fill all machines at start up (e.g., there are only 3 cookies, but 5 cookies are needed; fill machine with 3). • Start up all available machines at the same time. • Shut down all machines at the same time.

Analysis and Design Make sure you understand all the requirements. Ask for clarifications and missing information before you move on to the design phase. Select an additional model that you are going to implement. It must be an object-oriented system and make sure to take advantage of composition and inheritance in your design. Draw a UML class diagram showing both has-a and is-a relationships as applicable.

Include as much attributes and behaviors as you can for each class. Feel free to use pseudocode to document some complex behaviors. You may want to design the layout of the report as well. Implementation Write a vending machine application by putting those classes together. The program first loads data from products.txt and machines.txt (should work with other data files as long as they follow the same format – more products and/or more machines).

It then allows customers to make purchases. Print helpful messages to the screen so that we know what is going on. You should be able to utilize polymorphism so that you will not need to do unnecessary work (hint: an array/vector of generic machine objects and you can write code like machines[i].purchase()). Incorporate as many useful OOP feature as you can and points will be deducted if you do not utilizing at least some useful OOP features (e.g., const member functions, composition and aggregation, inheritance, operator overloading, etc.). You might not be able to finish the whole project so you should prioritize your features as follow: 1.

Input data from the two files (machines.txt and products.txt) – can start with testMachineA.txt or testMachineC.txt instead of machines.txt 2. Support one machine for one model such as model 100A or 100C 3. Support multiple machines for one model and other models – can work with machines.txt (read and ignore data for unimplemented models) 4. Output report to a file Team project: It is not required but it is highly recommended that you work in a team of two or three people since there will be lots of work for one person. You must sign up by a specified deadline if it is going to be a team project (MW section -- Wednesday, 05/15/19; TTh section -- Thursday, 05/16/19).

Make sure to split the responsibilities equally and work together (each person on the team should be responsible for one or more classes). You do need to provide a short description on who did what and your experience as a team project. If there are features that you like to add to your application, let me know ahead of time. Project presentation: Each team must do a short presentation about your project (including a 1-person team) or points will be deducted. It will be around 10 minutes and you need to discuss status, show your design (UML class diagram), demonstrate the program (running specified test cases), and answer questions.

Extra credit: You can earn up to 6 additional points for two of the following (each feature is worth 3 points): • Fully utilizing OOP approach – minimal main() with well-defined related classes, good use of has-a and is-a relationships (3 points) • Implementation of model 100D (3 points) • Refill machine -- add more coins and product items to a machine (3 points) • Purchase multiple items in one transaction (3 points) • Pre-approved additional feature (3 points) – propose and ask for approval Bonus points: The best overall project will earn an extra 6 points, the second best overall project will earn an extra 4 points, and the third best overall project will earn an extra 2 points. It will be based on the following with 1 being the most important: 1.

Fully implementation of required features 2. Good utilization of OOP 3. Your program is robust and easy to use (input validation and helpful output) 4. Good presentation/demonstration by the whole team (handout, PowerPoint, planned test cases/scenarios, etc.) 5. Work well as a team Please provide documentation and applying good coding style because it is part of the grade.

Use the provided template as the starting point. You must come up with a sufficient number of test cases since the test cases are also part of the grade. Please submit the following items in a folder if flash drive is included for each team (can also submit source code ahead of time via Canvas and a folder is not needed). You can also submit just a hardcopy of the title page and remaining items electronically via Canvas (a PDF file of all printouts and actual source files in a .zip file). Each team only needs to submit one set of project submission.

1. Title page with name, class, project number, and relevant information about your program (compiler and system used, file names). 2. Status and team information (if applicable). Clearly document extra features and missing features if applicable.

3. Design documentation – UML class diagram and pseudocode if applicable. 4. Printouts of any input/output. Include the test cases on project sheet.

5. A printout of the source code. 6. A copy of source code on a flash drive or Canvas -- source code (.h and .cpp files in a .zip file). Your program will be graded as follow: • Correctness/Efficiency: 40 points • Test Cases: 5 points • Documentation/Coding Style: 10 points • Presentation: 5 points © by T. Vo

.20 (2 $, 0 Q, 1 D, 2 N) Machine inventory: Code Id Description Initial Current 1A 1034 candy bar B 1000 chocolate chips C 1100 cookies D 1123 brownie E 1222 protein bar 5 5 Machine: 100B1 Initial balance:

100a 22 4 451a 1034 51b 1000 101c 1100 11d 1123 201e 1

100A A B C D E A B C D E F G B A B C C A B C A B C D D A B C chocolate chips candy bar cookies brownie protein bar coke can 6 oz coke bottle diet coke can diet coke bottle oz orange juice oz orange juice apple juice gatorade regular coffee large coffee decaff coffee hot chocolate latte cappuccino ham sandwich egg sandwich tuna sandwich healthy salad CSCI 140 -- Project 4 (Vending Machine System II) Must present and turn in Tuesday, 06/04/2019 (TTh Section) Must present and turn in Monday, 06/03/2019 (MW Section) Problem Statement A company intends to build a vending machine system and it wants you to develop a customized object-oriented software for its system. This company currently has plan for four different models (100A, 100B, 100C, and 100D) and it is planning to add several more in the future.

A customer can utilize one or more models by setting up an approriate data file. Each machine shall be able to keep track of its inventory, money (if applicable), and transactions. Inventory for each system shall consist of a list of product items and a quantity for each. Money for each system shall consist of number of nickels, dimes, quarters, and dollar bills if applicable (no pennies). We will assume that the cost for each item is a multiple of 5 cents.

Model 100A accepts one-dollar bill only and it give back changes using coins as well as utilizing a lower denomination if needed (similar to project 1 and you can ignore special case like Q = 2, D = 4, N = 0, and you need to give back 55 cents). Model 100B accepts coins and one-dollar bills, but it returns changes in coins only and it utilizes lower denomination including special case like Q = 2, D = 4, N = 0, and you need to give back 55 cents if needed (similar to project 1 with extra credit 1 and 2). Model 100C accepts credit card payment only and it automatically rejects a purchase after two invalid credit card entries. See below for requirements in validation a credit card. Model 100D accepts both coins (like 100A) and credit card (like 100C).

In general, an invalid transaction will not be processed and money will be returned if applicable. You are required to provide an implementation for model 100A, model 100B, and model 100C. All Credit Card numbers follow certain patterns. A credit card must have between 13 and 16 digits and it must start with a 4, 5, 37, or 6. In 1954, Hans Luhn of IBM proposed an algorithm for validating credit card numbers.

This algorithm is useful to determine if a card number is entered correctly or if a credit card is scanned correctly by a scanner. Almost all credit card numbers are generated following this validity check, which can be described as follows: 1. Double every second digit from right to left. If doubling of a digit results in a two- digit number, add up the two digits to get a single-digit number. For example, if a particular second digit were 4, then computing that digit would be 4 x 2 = 8.

If a particular second digit were 6, then computing that digit would be 6 x 2 = 12 → 1 + 2 = 3. 2. Now add all single-digit number from Step 1. 3. Add all digits in the odd places from right to left in the card number.

4. Sum the result from Step 2 and Step 3. 5. If the result from Step 4 is divisible by 10, the card number is valid. If the result from Step 4 is not divisible by 10, it is invalid.

You must use Luhn’s algorithm to determine if the Credit Card number is valid or not. • Example valid Credit Card number: • Example invalid Credit Card number: • Try your own credit card! The vending machine system will load all machines with data from input data files (machines.txt and products.txt) upon a secret code of “spring19†is entered by an operator. Once an operator initiates the system with a special code, customers will be able to make a purchase by selecting a machine first, selects an item, and then enters a purchase amount. After the system is in use and after a correct secret code is entered, the system will generate a detailed report for each machine in an output file, reports.txt, and then shuts down all machines.

See below for a sample input/output for models 100A and 100C and you should follow similar interface for models 100B and 100D. Do not include models that your system cannot support at this time. Please enter a startup code --> spring19<E> Initialize machines. Please wait ... Machines are ready.

Available machines: 100A1, 100A2, 100B1, 100C1, 100C2 Select a machine --> 100A1<E> This machine accepts one-dollar bill only. Available items: 1A 50 candy bar 1B 35 chocolate chips 1C 75 cookies 1D 60 brownie 1E 165 protein bar Select an item --> 1B<E> You selected “chocolate chipsâ€. The cost of this item is 35 cents. Insert your money --> 100 0<E> You entered an amount of 100 cents. Processing your purchase ...

Your change of 65 cents is given as: quarter(s): 2 dime(s): 1 nickel(s): 1 Thank you! Please take your item. Select a machine --> 100A1<E> This machine accepts one-dollar bill only. Available items: 1A 50 candy bar 1B 35 chocolate chips 1C 75 cookies 1D 60 brownie 1E 165 protein bar Select an item --> 1B<E> You selected “chocolate chipsâ€. The cost of this item is 35 cents.

Insert your money --> 100 0<E> You entered an amount of 100 cents. Processing your purchase ... Insufficient changes! Your transaction cannot be processed. Please take back your dollar bill.

Select a machine --> 100A1<E> This machine accepts one-dollar bill only. Available items: 1A 50 candy bar 1B 35 chocolate chips 1C 75 cookies 1D 60 brownie 1E 165 protein bar Select an item --> 1C You selected “cookiesâ€. The cost of this item is 75 cents. Insert your money --> 100 0<E> You entered an amount of 100 cents. Processing your purchase ...

Your change of 25 cents is given as: quarter(s): 0 dime(s): 2 nickel(s): 1 Thank you! Please take your item. Select a machine --> 100A1<E> This machine accepts one-dollar bill only. Available items: 1A 50 candy bar 1B 35 chocolate chips 1D 60 brownie 1E 165 protein bar Select an item --> 1B<E> You selected “chocolate chipsâ€. The cost of this item is 35 cents.

Insert your money --> 0<E> You chose to cancel your selection. Select a machine --> 100C1<E> This machine accepts credit card only. Available items: 1A 300 ham sandwich 1B 275 egg sandwich 1C 325 tuna sandwich Select an item --> 1B You selected “egg sandwichâ€. The cost of this item is 275 cents. Enter your credit card number --> <E> Invalid credit card number was entered.

Enter your credit card number --> <E> Your credit card was successfully charged for $2.75. Thank you! Please take your item. Select a machine --> 100B1<E> This machine accepts coins or one-dollar bill. Available items: 1A 80 coke bottle 1B 45 coke can 6 oz 1C 80 diet coke bottle Select an item --> 1C<E> You selected “diet coke bottleâ€.

The cost of this item is 80 cents. Select an option (1 - dollar bill and 2 - coins) --> 2<Enter> Please insert your coins --> <Enter> You inserted an amount of 85 cents. Processing your purchase ... Your change of 5 cents is given as: quarter(s): 0 dime(s): 0 nickel(s): 1 Thank you! Please take your item.

Select a machine --> 100B1<E> This machine accepts coins or one-dollar bill. Available items: 1A 80 coke bottle 1B 45 coke can 6 oz 1C 80 diet coke bottle Select an item --> 1B<E> You selected “coke can 6 ozâ€. The cost of this item is 45 cents. Select an option (1 - dollar bill and 2 - coins) --> 1<Enter> Insert your money --> 100 0<E> You entered an amount of 100 cents. Processing your purchase ...

Your change of 55 cents is given as: quarter(s): 1 dime(s): 3 nickel(s): 0 Thank you! Please take your item. Select a machine --> 100C2<E> This machine accepts credit card only. Available items: 1A 300 ham sandwich 1C 325 tuna sandwich 1D 200 healthy salad Select an item --> 1D You selected “healthy saladâ€. The cost of this item is 200 cents.

Enter your credit card number --> <E> Invalid credit card number was entered. Enter your credit card number --> <E> Invalid credit card number was entered. Too many invalid attempts. Your selection is cancelled. Select a machine --> spring19<E> Report is generating ...

System is shutting down. Sample report for machinesOutput.txt (processed machines for test cases above, but you need to print all available machines): Machine: 100A1 Initial balance: $1.10 (0 $, 2 Q, 4 D, 4 N) Number of valid transactions: 2 Total cost: $1.10 Current balance: $2.20 (2 $, 0 Q, 1 D, 2 N) Machine inventory: Code Id Description Initial Current 1A 1034 candy bar B 1000 chocolate chips C 1100 cookies D 1123 brownie E 1222 protein bar 5 5 Machine: 100B1 Initial balance: $0.95 (0 $, 2 Q, 4 D, 1 N) Number of valid transactions: 2 Total cost: $1.30 Current balance: $2.20 (1 $, 4 Q, 2 D, 0 N) Machine inventory: Code Id Description Initial Current 1A 2180 coke bottle B 1283 coke can 6 oz C 3629 diet coke bottle 5 4 Machine: 100C1 Initial balance: $0.00 (0 $, 0 Q, 0 D, 0 N) Number of valid transactions: 1 Total cost: $2.75 Current balance: $2.75 (0 $, 0 Q, 0 D, 0 N) Machine inventory: Code Id Description Initial Current 1A 6774 ham sandwich B 6869 egg sandwich C 6879 tuna sandwich 2 2 Machine: 100C2 Initial balance: $0.00 (0 $, 0 Q, 0 D, 0 N) Number of valid transactions: 0 Total cost: $0.00 Current balance: $0.00 (0 $, 0 Q, 0 D, 0 N) Machine inventory: Code Id Description Initial Current 1A 6774 ham sandwich B 6869 egg sandwich C 6879 tuna sandwich D 6879 Healthy salad 10 10 There will be a data file, machines.txt, contains information about the number of machines, model, money, and available items.

Another data file, products.txt, contains all product items to be loaded in the machines. We will also make these assumptions as well: • Each product item consists of an id, description, and price. • A purchase amount will be entered as a list of denominations and terminates by a sentinel value of 0 (e.g., or 100 0 or ). • An amount of 0 (for money) or 2 invalid attempts (credit card) will cancel an item selection. • An invalid denomination being entered will be ignored. • The input data files contain valid data, but it there might not be enough items to fill all machines at start up (e.g., there are only 3 cookies, but 5 cookies are needed; fill machine with 3). • Start up all available machines at the same time. • Shut down all machines at the same time.

Analysis and Design Make sure you understand all the requirements. Ask for clarifications and missing information before you move on to the design phase. Select an additional model that you are going to implement. It must be an object-oriented system and make sure to take advantage of composition and inheritance in your design. Draw a UML class diagram showing both has-a and is-a relationships as applicable.

Include as much attributes and behaviors as you can for each class. Feel free to use pseudocode to document some complex behaviors. You may want to design the layout of the report as well. Implementation Write a vending machine application by putting those classes together. The program first loads data from products.txt and machines.txt (should work with other data files as long as they follow the same format – more products and/or more machines).

It then allows customers to make purchases. Print helpful messages to the screen so that we know what is going on. You should be able to utilize polymorphism so that you will not need to do unnecessary work (hint: an array/vector of generic machine objects and you can write code like machines[i].purchase()). Incorporate as many useful OOP feature as you can and points will be deducted if you do not utilizing at least some useful OOP features (e.g., const member functions, composition and aggregation, inheritance, operator overloading, etc.). You might not be able to finish the whole project so you should prioritize your features as follow: 1.

Input data from the two files (machines.txt and products.txt) – can start with testMachineA.txt or testMachineC.txt instead of machines.txt 2. Support one machine for one model such as model 100A or 100C 3. Support multiple machines for one model and other models – can work with machines.txt (read and ignore data for unimplemented models) 4. Output report to a file Team project: It is not required but it is highly recommended that you work in a team of two or three people since there will be lots of work for one person. You must sign up by a specified deadline if it is going to be a team project (MW section -- Wednesday, 05/15/19; TTh section -- Thursday, 05/16/19).

Make sure to split the responsibilities equally and work together (each person on the team should be responsible for one or more classes). You do need to provide a short description on who did what and your experience as a team project. If there are features that you like to add to your application, let me know ahead of time. Project presentation: Each team must do a short presentation about your project (including a 1-person team) or points will be deducted. It will be around 10 minutes and you need to discuss status, show your design (UML class diagram), demonstrate the program (running specified test cases), and answer questions.

Extra credit: You can earn up to 6 additional points for two of the following (each feature is worth 3 points): • Fully utilizing OOP approach – minimal main() with well-defined related classes, good use of has-a and is-a relationships (3 points) • Implementation of model 100D (3 points) • Refill machine -- add more coins and product items to a machine (3 points) • Purchase multiple items in one transaction (3 points) • Pre-approved additional feature (3 points) – propose and ask for approval Bonus points: The best overall project will earn an extra 6 points, the second best overall project will earn an extra 4 points, and the third best overall project will earn an extra 2 points. It will be based on the following with 1 being the most important: 1.

Fully implementation of required features 2. Good utilization of OOP 3. Your program is robust and easy to use (input validation and helpful output) 4. Good presentation/demonstration by the whole team (handout, PowerPoint, planned test cases/scenarios, etc.) 5. Work well as a team Please provide documentation and applying good coding style because it is part of the grade.

Use the provided template as the starting point. You must come up with a sufficient number of test cases since the test cases are also part of the grade. Please submit the following items in a folder if flash drive is included for each team (can also submit source code ahead of time via Canvas and a folder is not needed). You can also submit just a hardcopy of the title page and remaining items electronically via Canvas (a PDF file of all printouts and actual source files in a .zip file). Each team only needs to submit one set of project submission.

1. Title page with name, class, project number, and relevant information about your program (compiler and system used, file names). 2. Status and team information (if applicable). Clearly document extra features and missing features if applicable.

3. Design documentation – UML class diagram and pseudocode if applicable. 4. Printouts of any input/output. Include the test cases on project sheet.

5. A printout of the source code. 6. A copy of source code on a flash drive or Canvas -- source code (.h and .cpp files in a .zip file). Your program will be graded as follow: • Correctness/Efficiency: 40 points • Test Cases: 5 points • Documentation/Coding Style: 10 points • Presentation: 5 points © by T. Vo