Project 3 - Computer Science I and Problem Solving | CS 23021, Study Guides, Projects, Research of Computer Science

Material Type: Project; Class: CS I PROG/PROBLEM SOLVING; Subject: Computer Science; University: Kent State University; Term: Fall 2006;

Typology: Study Guides, Projects, Research

Pre 2010

Uploaded on 08/01/2009

koofers-user-i23
koofers-user-i23 🇺🇸

10 documents

1 / 1

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
CS23021 CS1 – Programming and Problem
Solving
Project #3 – Extra Credit
Due by 11:59pm on November 2, 2006
In this extra credit assignment you will have the opportunity to demonstrate the usefulness of
functional abstraction by implementing a second version of a function to output the ‘get money’
prompt and take in the monetary value entered by the user as required in Project #3.
Specifically, you will need to encapsulate the part of the original Project3 that prints out:
Please enter the amount of money deposited (in dollars): 1.50
and takes in the value entered by the user. For example let’s say that your original program
included a function called “get_money”, then, you will need to write a new “get_money” code in a
file called input2.cpp. This new function needs to accept the user input in a different type of
variable than you used for your original project3 work but must return the same type of value as in
your first version. Thus this new function encapsulates all of the processing that must be done to
get the money amount deposited by the user and converted it into a single integer amount that is
returned to the calling program (which may be another function besides “main” depending on how
you implemented your original solution).
When implemented correctly your new function can be linked together with your original code by
adding a new goal to your Makefile. The new goal must be called vend2 and must be
implemented so that your input2.cpp file is a dependency together with any other dependencies
(main.cpp, etc) as required by your particular implementation. In other words no other part of
your main.cpp executable code from project #3 should be changed for this extra-credit project.
You should place your extra-credit work in a directory called Project3extra. This directory should
contain the following files*:
main.cpp – contains main(). [from Project3]
vendlib.h – contains the global constants and function prototypes. [from Project3]
vendlib.cpp – contains the function definitions from Project3**
input1.cpp – contains the “get_money” function definition used in Project3**
input2.cpp – contains the function definition for your new “get_money” function
Create and commit all files listed above to a Project3extra directory in your repository. Ensure
that your code is properly commented and has good programming style.
You must have a working Project3 program in order to be eligible for this extra credit. If your
original Project3 does not compile and execute correctly you must first redo Project3 before you
can be eligible to turn in code for this extra-credit.
* Keep in mind that if in your original project you used a different function name for the code that
‘gets the money’, you will need to use that function name instead of “get_money” to implement
this project.
** not including the “get_money” function
This extra-credit assignment is worth 50 points towards your course grade.

Partial preview of the text

Download Project 3 - Computer Science I and Problem Solving | CS 23021 and more Study Guides, Projects, Research Computer Science in PDF only on Docsity!

CS23021 CS1 – Programming and Problem

Solving

Project #3 – Extra Credit

Due by 11:59pm on November 2, 2006

In this extra credit assignment you will have the opportunity to demonstrate the usefulness of functional abstraction by implementing a second version of a function to output the ‘get money’ prompt and take in the monetary value entered by the user as required in Project #3.

Specifically, you will need to encapsulate the part of the original Project3 that prints out:

Please enter the amount of money deposited (in dollars): 1.

and takes in the value entered by the user. For example let’s say that your original program included a function called “get_money”, then, you will need to write a new “get_money” code in a file called input2.cpp. This new function needs to accept the user input in a different type of variable than you used for your original project3 work but must return the same type of value as in your first version. Thus this new function encapsulates all of the processing that must be done to get the money amount deposited by the user and converted it into a single integer amount that is returned to the calling program (which may be another function besides “main” depending on how you implemented your original solution).

When implemented correctly your new function can be linked together with your original code by adding a new goal to your Makefile. The new goal must be called vend2 and must be implemented so that your input2.cpp file is a dependency together with any other dependencies (main.cpp, etc) as required by your particular implementation. In other words no other part of your main.cpp executable code from project #3 should be changed for this extra-credit project.

You should place your extra-credit work in a directory called Project3extra. This directory should contain the following files*:

  • main.cpp – contains main(). [from Project3]
  • vendlib.h – contains the global constants and function prototypes. [from Project3]
  • vendlib.cpp – contains the function definitions from Project3**
  • input1.cpp – contains the “get_money” function definition used in Project3**
  • input2.cpp – contains the function definition for your new “get_money” function

Create and commit all files listed above to a Project3extra directory in your repository. Ensure that your code is properly commented and has good programming style.

You must have a working Project3 program in order to be eligible for this extra credit. If your original Project3 does not compile and execute correctly you must first redo Project3 before you can be eligible to turn in code for this extra-credit.

  • Keep in mind that if in your original project you used a different function name for the code that ‘gets the money’, you will need to use that function name instead of “get_money” to implement this project. ** not including the “get_money” function

This extra-credit assignment is worth 50 points towards your course grade.