Create a front­end system for a vending machine

Assignment Help C/C++ Programming
Reference no: EM13846074

You have been approached by a company to create a front­end system for a vending machine written in C. The vending machine serves all kinds of pastry treats. The company's name is Penelope's Pastry Delights and as such, the executable you are creating will be called "ppd"

Note: for this assignment you may use either gcc or clang which are both installed on the coreteaching machines. Many developers prefer to use clang as they feel that it provides more friendly error messages. clang accepts the same arguments as gcc so there should not be any problem there.

In this assignment you are to implement an application that will perform the above tasks as a single user model - which will then be used as a prototype for how the new system would look.

You will need to demonstrate your understanding and programming ability, with respect to more advanced C programming principles. The concepts covered include:

• Command line arguments.
• File handling.
• Dynamic memory allocation and linked lists.
• Modularisation and multi­file programs.
• Makefiles.
• Function pointers
• All concepts covered in Assignment #1.

Requirement #1 Command­line arguments

A user of your program must be able to execute it by passing in the names of two data files that the system is to use. You need to check that exactly 3 command line arguments are entered.

Requirement #2 Load Data

Your program needs to be populated with the data provided in the 2 data files whose names are conveyed via the command line. You will need to tokenize this data in order to load it into the system. Use the structure definitions provided in the startup code to store your system data. As part of this requirement you need ensure that the specified files are valid (that is, they exist and the data contained in them matches the specification for this assignment). You need to abort the program and provide a suitable error message if this is not the case.Requirement #3 Implement Main Menu Structure (6 marks)
The main menu data structure is to be implemented as an array of struct menu_item.

Requirement #3  Implement Main Menu Structure

Requirement #4 Display Main Menu

Your program must display an interactive menu displaying 9 options.

Requirement #5 Display Items

This option allows the user to request a display of the items available for purchase.

Requirement #6 Purchase Item

This option allows the user to purchase an item from the menu. This function is called from the main menu when the user has finally decided to purchase an item. This function allows the user to pay for their item by collecting money from them, and adjusting balances within the system as appropriate. Change is then given back to the customer, if appropriate. The number of items on hand should also be deducted. You should not allow an item to be purchased if there are 0 or less of that item on hand.

Requirement #7 Save and Exit

You must save all data to the data files that were provided on the command line when the program loaded up. When the saving is completed, you must have the program exit. The specifications mentioned for each file must be maintained and the program must be able to load up your files as easily as it loaded up the files that we have provided you with. Also, at this point, once you have implemented dynamic memory allocation, you must free all memory allocated and exit the program. A program which does everything but exit the program will still lose marks, as much as a program that does not implement any other requirement.

Requirement #8 Add Item

This option adds an item to the system. When the user selects this option, the system should generate the next available item id and associate that with this item. The user should then be prompted for the Name and Description and Price (a valid amount of money in dollars and cents). The item should then be allocated the default "on hand" value specified in the startup code. The new item id shall have an ‘I' prepended to it and will be 5 characters long.

Requirement #9 Remove Item

Remove an item from a category and delete it from the system, including free memory that is no longer being used.

Requirement #10 "Reset Stock Count"

This option will require you to iterate over every stock in the list and set its 'on hand' count to the default value specified in the startup code.

Requirement #11 "Reset Coin Count"

This option will require you to iterate over every coin in the coin list and set its 'count' to the default value specified in the startup code.

Requirement 12 "Display Coins"

This option will require you to display the coins as follows.

Requirement #13 "Abort"

This option should terminate your program. All program data will be lost. You should also be freeing memory at this point as well.

Requirement #14 Return to menu functionality

Your program should allow the user to return to the main menu at any point during these options. The user can do this by either hitting enter or pressing ctrl­d on an empty line. If the user is in the middle of a transaction, that transaction should be cancelled.

Requirement #15 Makefile

Your program must be compilable using a makefile. All compile commands must include the "­ansi ­Wall ­pedantic" compile options and compile cleanly with these options. Your makefile needs to compile your program incrementally, i.e., use object files as an intermediate form of compilation.

Also include a target called "clean" that deletes unnecessary files from your working directory such as object files, executable files, core dump files, etc. This directive should only be executed when the user types "make clean" at the command prompt.

Have a look at the courseware on blackboard for examples of makefiles. There are also many examples of makefiles provided in the lecture material.

Requirement #16 Memory leaks and abuses

The startup code requires the use of dynamic memory allocation. Therefore, you will need to check that your program does not contain memory leaks. Use the "valgrind ­­leak­check=full ­­show­reachable=yes <command> <arguments>" to check for memory leaks. Marks will only be awarded for this requirement if the feedback valgrind provides reports zero memory leaks and no other memory related problems.

Another common problem in is memory abuses. These are inappropriate accesses such as reading from uninitialized memory, writing to memory addresses you should not have access to and conditional statements that depend on uninitialized values. You can test for these again by using valgrind:

Requirement #18 Proper Use of an ADT

In this assignment, you are implementing an Abstract data type - a list. One list is implemented as an array and the other list is implemented using a linked list. For this requirement you will need to propose a list of interface functions for each list and implement these. All references to these types should be via these interface functions.

Requirement #19 General requirements

You must read the "Functional Abstraction" "Buffer Handling" , "Input Validation" and "Coding Conventions and Practices" requirements of the "COSC1076 Advanced Programming Techniques General Assignment Information" document.

Requirement #20 Assignment Demonstration

You are required to attend an assignment demonstration in week 10 or 11. You will be required to demonstrate requirements 5,6, 8 and 9 in this demonstration. Please note that this includes implementation of any requirements that these options depend upon. After you have demonstrated your program working you will need to submit your files to weblearn. You will be required to compile and run your program on saturn, jupiter or titan. Please attend your regular scheduled lab.

Attachment:- cp.zip

Reference no: EM13846074

Questions Cloud

Epidemiology of health promotion : Select one of the epidemiologic core functions and provide an example of the how the core function might be demonstrated in clinical practice by an advanced nurse practitioner
Identify mission and strategy of automobile repair garage : Identify the mission and strategy of your automobile repair garage.
Alculate the nwc to total assets ratio for each year : alculate the NWC to total assets ratio for each year
Article- drugs and abuse : Article- Drugs and Abuse, purpose of the article and main points (please summarize in your own words and do not list!
Create a front­end system for a vending machine : Create a front­end system for a vending machine written in C. The vending machine serves all kinds of pastry treats. The company's name is Penelope's Pastry Delights and as such, the executable you are creating will be called "ppd"
Decision makers and analysts look deeply into profitability : Decision makers and analysts look deeply into profitability ratios
Write a creative story involving math fractions : Write a creative story involving math fractions without the use of numbers, basically how you or someone else would use Math fractions in any daily situation. For example "half" is allowed as an example for your story but not
Worksheet eliminations in journal entry : Prepare all worksheet eliminations in journal entry form necessary to consolidate Crain and Downey at December 31, 2005. Prepare the consolidation worksheet for Crain and Downey at December 31, 2005.
What is the sustainable growth rate? : What is the sustainable growth rate?

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Ansi-c program complete assignment as per written in the

complete assignment as per written in the

  Computing the standard deviation

Input Details: The scores are entered as numbers with or without decimal points. In response to the continuation prompts (described below) the user types a y or a Y to signify "continue" with any other character signifying "quit".

  Function named sort that takes three integer parameter

Write a function named sort that takes three integer parameters by reference. The function should rearrange the parameter values so that the first parameter gets set to the smallest value, the second parameter gets set to the second smallest value, a..

  A "mynum" class that will read "randfile.txt" file

A "MyNum" class that will read "randFile.txt" file and obtain the 20,000 integer numbers

  Create a friend class bestfriend to the class frac

Create a friend class BestFriend to the class frac. Inside the class BestFriend, and implement a function outputfrac() to print the content of the frac instance

  Calculate the net pay as the gross less the taxes

Design and code a new function that accepts as parameters the gross pay by value and the federal tax, state tax, local tax, SS tax, and net Pay by reference.

  Create a function that returns true

Create a function that returns true if the input is a numeric row vector and false otherwise - single input which may be any data class.

  Write a matrix multiplication program

Write a C++, matrix multiplication program which you can instrument to monitor and measure execution time as a function of problem size. Make sure it works in Microsoft Visual Studio.

  Ansi-c program complete assignment as per written in the

complete assignment as per written in the attached

  Design a simple atm service kiosk

Design a simple ATM service kiosk. This kiosk supports the following options for its menu: 1. Viewing your account balance2. Depositing cash3. Withdrawing cash

  Flipflaps - game based on pancake sorting

The project is to design and write a C++ 11/FLTK game program with a graphical user interface.The game is based on "pancake sorting,", which actually has some mathematical significance.

  Use structures to create c program to compute student record

Explain the following and give their suitable syntax. A pointer. Use structures to create C program to compute and store student records of class.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd