Bergen Community College

Division of Business, Math & Social Science

 

Information Technology

Fall 2002

Course Outline

 

 

Instructor:

Professor Anita Verno

Faculty Web-Site: 

www.bergen.edu/faculty/averno 

Course Web Site:

http://dl.bergen.edu/webct/public/home.pl

E-mail:

averno@bergen.edu

Telephone with Voice Mail:

201-447-7909

Office:

S-330

Office Hours: 

TBA

 

Course Title:

INF-152   C/C++ Programming for Business

Course Syllabus at http://www.bergen.edu/departments/business/inf/syllabi

Textbooks and Supplies:

·         Jeff Salvage, The C++ Coach, Essentials for Introductory Programming, Addison Wesley, 2001, ISBN 0‑201‑70289‑4

·         3 ½” High Density Diskettes for submitting assignments

·         100MB or 250MB zip disks for work in Lab

·         Recommended:  Microsoft Visual C++ 6.0 compiler for home PC (Introductory Edition Software will suffice for most lab work)

Additional Class Information:

Assessment – The lowest lab grade will be dropped at the end of the semester.

 

 

 


INF-152 – Calendar

 

Session

Lecture*

Language Specifics

Lab*

1

_________

Course Introduction

 

Chap 1

Introduction

 

Appendix A

Quality Programming

Parts of a program

Orientation to Visual C++

 

Lab 1A First C++ Program

Lab 1B First C Program

Lab 1C Coins (code in C)

Lab 1D Coins (code in C++)

2

_________

Chap 2 Sections 2.1-2.8

Fundamental C++ Programming

Comments

Data types

Variables

Arithmetic expressions

Basic I/O

 

Lab 2A – Page 47 #3

Lab 2B – Page 47 #7

Lab 2C Sizeof (as distributed)

Lab 2D Sizeof (using good style)

3

_________

Chap 2 Sections 2.9-2.12

Fundamental C++ Programming

Characters

Type conversions

Complex assignment operators

Increment/decrement

Order of operations

Lab 3A – Page 48 #5

Lab 3B Celsius to Fahrenheit

Lab 3C Height and Weight

4

_________

Chap 3

Conditional Statements

if

switch

Lab 4A Behind Bars

5

_________

Exam 1

Chap 1-3, Appendix A

 

Appendix C Pages 621-632

Commonly Used C++ Input/Output Techniques

<iomanip.h>

cout.setf (ios :: flag)

cout.unsetf (ios :: flag)

Escape sequences

Project 1

Main Menu

Customer Menu

Vendor Menu

6

_________

Chap 4 (skip section 4.5)

Loops

For

While

Do

Lab 6A – Page 169 #4

 

Project 2

Add loops to menus

7

_________

Chap 5 Sections 5.1-5.4

Functions

Function declaration

Scope

Lab 7A Song

 

Project 3

·         Main Menu calls functions for Customer and Vendor menus

·         Each choice from Main, Customer, and Vendor menus calls a function

8

_________

Chap 5 Sections 5.5-5.8

Functions

Pass by value

Pass by reference

Lab 8A Course average

9

_________

Exam 2

Chap 1-5, Appendix A, Appendix C

 

Chap 6

Simple Arrays

 

Chap 7 Section 7.1

String Functions

1-D arrays

2-D arrays

Strings

Lab 9A Swap

 

Project 4

Create a set of parallel arrays

Implement Customer #1, #2

Implement Vendor #5, #6

10

_________

Chap 7 Sections 7.2-7.3, 7.5, 7.6

Simple Arrays Applications

 

Chap 8 Section 8.2

Advanced Array Applications

File I/O

 

Project 5

Implement Vendor #2, #3, #4

Implement Vendor #1 using a sequential search

11

_________

Chap 9

Pointers

Pointers

User-defined types

Dynamic memory

Lab 11A Convert date

 

Project 6

Implement the id/password match for Main Menu #2

12

_________

Chap 10

Structures and Basic Classes

Structures

Lab 12A – Page 419 #2

 

Project 7

Implement Initialize Data

Implement Save Data

13

_________

Chap 11 Sections 11.1-11.4

More on Classes

Classes

Project

Complete any missing code

Test

 

Bonus Points (at instructor’s discretion) – Once project is fully tested, create a duplicate project and modify the code to use a different data type

14

_________

Assorted topics

Project

 

Project Due

15

_________

Exam 3

Chap 1-11, Appendix A, appendix C

 

 

 

*Assignments may be modified based upon time constraints


 

Project Requirements

 

 

Create a monitoring program for a vending machine.  The program will be used to insure that the candy vending machine in the S-wing at BCC is always full. 

 

 

Main Menu

At startup, a main menu appears.  This menu allows the user to select between 3 options:

1.                   Customer – the hungry overworked student who needs some “quick sugar energy” to continue working.

2.                   Vendor – the owner of the machine.  If vendor is selected, an id and password will be requested and validated against a saved id/password.

3.                   Exit – A process initiated by the BCC Public Safety Officer on his rounds at 11:00 PM that saves the current inventory in the vending machine and terminates the program until the next morning.

 

Customer Menu

The Customer menu provides two options:

1.                   List Items – This choice displays a list of all candy in stock in the machine and the corresponding ID number.

a.       Only items with a quantity greater than zero are displayed.

2.                   Buy – This choice allows the user to specify one item by ID number.

a.       Display a list of candy in stock and the ID numbers – i.e. call List Items (#1)

b.       The ID number must be a valid entry.

c.       There need be at least one of that candy item in stock.

d.       Purchase price will be displayed (all candy sells for $1.00 or less).

e.       The customer will enter the amount of money in coins (quarters, dimes, and nickels only) to represent the actual feeding of the vending machine.  Ex:  2 quarters, 2 dimes, 1 nickel.

f.         The program will display the change due the customer and will provide a “dispense candy” message such as “Eat and enjoy” or “Don’t work too hard”.

g.       The quantity for that item must be decreased by 1.

3.                   Return to Main Menu – Displays the Main Menu

 

Vendor Menu

This is a more complex menu.

1.                   New Item – Permits the entry of a new candy item that was not previously sold.

a.       The item name, quantity added, and price must be entered.

b.       The program must assign the item an ID number.

c.       Only 10 items fit in the machine.  You cannot add an 11th item.

2.                   Delete Item – Removes the item from the vending machine.

a.       The ID number of the item needs to be entered.

b.       You may only delete an item if the quantity is 0.

3.                   Add Inventory – Update the quantity

a.       The ID number and quantity being ADDED or SUBTRACTED is specified

b.       The quantity cannot exceed 5 for any particular type of candy.

c.       The quantity must be at least zero.

4.                   Update Price – Allows modification to the sales price of the candy.

a.       The ID number and new price must be specified.

b.       The price must be at least $ .25

c.       The price cannot exceed $1.00

5.                   Detail Report – Display a nicely formatted table for each item regardless of its quantity (quantity of zero is included).

a.       Item code

b.       Item name

c.       Quantity

d.       Price

6.                   Exception Report – Display a nicely formatted table for items that need to be filled immediately (quantity is less than 2).

a.       Item Code

b.       Item name

c.       Quantity

7.                   Return to Main Menu – Displays the Main Menu

 

Additional Operations

1.                   Initialize Data – When the program begins, the item information must be read from a text file.

2.                   Save Data – When Exit is selected from the Main Menu, the current information must be written to a text file.  This is the file that will be read by Initialize Data when the program is run again.

 

Data Types:

The basic candy information is:

·         Item ID number

·         Item name

·         Quantity

·         Price

 

There is a maximum of 10 different candy items in the vending machine at any given time.   You may choose to store this information in one of the following data types:

·         An array of pointers to a struct – Each menu activity must be implemented as a separate function.

·         An array of structs – Each menu activity must be implemented as a separate function.

·         An array of objects.  Each object contains the items mentioned above and the methods for manipulating the items.  Not every menu item need become a method.  Implement the others using functions.  The coding is much simpler using this implementation.

·         A set of parallel arrays – This implementation will require the most source code.

 

 

Note:  This is a professional business application.  Your menu should be designed accordingly.  Your code must meet professional standards with regard to comments, identifiers, and style.  Test each facet of your Monitoring System (all possibilities) to be sure it works.  Have a friend try the system to insure that they cannot "break it".

 

 

Phase I:

Decide which data type(s) you will be using.  Prepare flowcharts, pseudocode, of N-S charts that document your logic in solving this problem.  Remember that logic is shown separately for each function.  Review your analysis and flowcharts with me for approval.  My signature is needed before you begin to code.  You will submit this documentation with your project.

 

Phase II:

Code your program.  See me in class and during office hours for assistance.  Send e-mail with your questions.  Since you will be using a modular approach, I suggest that you code and test one section at a time.  If you need help in determining the proper starting point, ask!

 

Phase III:

Test your program as a complete unit.  Be sure to test all possibilities.  Have a friend try your program to insure that they cannot “break it”.  You may wish to discuss appropriate test input with me.

 

Phase IV:

Submit working project.  You MUST be able to answer questions regarding the design and your particular implementation of the design in C++.  Submission of a working project is required to pass the course.

 


 

Project Requirements – Point System

 

Main Menu

Meets professional standards                                                                                      +2

3 correct options                                                                                                        +2

Vendor choice checks for correct id/password based on info in file                                  +5

 

Customer Menu

1.       General       +3

a.       Meets professional standards                                                                       

b.       3 correct options                                                                                         

2.       List Items                                                                                                            +3

a.       Lists candy name and ID number, easy to read format                                   

b.       Only items with a quantity greater than zero are displayed                              

3.       Buy                                                                                                                                    +3

a.       Specify one item by ID number                                                                     

b.       Validate the ID number                                                                                

c.       Check stock > 0                                                                                         

d.       Display purchase price                                                                                

e.       Enter money by coin type                                                                            

f.         Calculate and display change due                                                                

g.       Provide a “dispense candy” message                                                            

h.       Decrease quantity by 1                                                                                

4.       Return to Main Menu                                                                                            +1

 

Vendor Menu

1.       General       +3

a.       Meets professional standards                                                                       

b.       7 correct options                                                                                         

2.       New Item                                                                                                             +3

a.       Entry of item name, quantity added, and price                                               

b.       ID number assigned                                                                                    

c.       Check to be sure you do not add more than 10 items                                     

d.       Item added                                                                                                 

3.       Delete Item                                                                                                          +3

a.       Request for ID number of the item                                                                 

b.       Check for quantity of 0                                                                                 

c.       Item deleted                                                                                               

4.       Add Inventory                                                                                                       +3

a.       Request for ID number                                                                                 

b.       Accept positive and negative numbers for quantity modification                       

c.       Check for quantity between 0 and 5                                                              

d.       Quantity updated                                                                                        

5.       Update Price                                                                                                        +3

a.       Request for ID number and new price                                                            

b.       The price must be at least $ .25 and cannot exceed $1.00                              

c.       Price updated                                                                                             

6.       Detail Report                                                                                                        +3

a.       Nicely formatted table including each item                                                     

b.       Table displays Item code, Item name, Quantity, Price                                    

7.       Exception Report                                                                                                 +3

a.       Nicely formatted table including each item with quantity < 2                            

b.       Table displays Item Code, Item name, Quantity                                             

8.       Return to Main Menu                                                                                            +1

 

 

Additional Operations

1.        Initialize Data

a.       Item information read from a text file                                                           +5

2.       Save Data

a.       Item data written to a text file                                                                    +5

 

Data Types

1.       Data type appropriate – struct, class, arrays                                                         +10

2.       Item ID number – int1                                                                                           +1

3.       Item name – string                                                                                               +1

4.       Quantity – int                                                                                                       +1

5.       Price – double or float                                                                                           +1

 

Other

1.       Each menu activity implemented as a separate function                                         +10

2.       Program is tested and runs without problems                                                        +10

3.       Code meets professional standards:                                                                     +10

a.       Menu design meets professional business application standards                     

b.       Well commented                                                                                         

c.       Descriptive identifiers                                                                                   

d.       Indentation and paragraphing used                                                                

4.       Flowcharts, pseudocode, N-S charts correctly document logic                                 +5

 

Total Points:                                                                                                             100

 

Note:  A few extra credit points are available for independent learning and demonstration of concepts not specifically covered in class.  Extra credit points are awarded at the teacher's discretion.