To the faculty page of James Tam Return to the course web page

CPSC 217: Mini-Assignment 2B

Due at 4 PM. For assignment due dates see the main schedule on the course webpage.

New Concepts to be applied for the assignment

Only new concepts that need to be applied in the assignment are listed, concepts previously applied in other assignments may need to used in the implementation of your solution.

Functional requirements

Similar to the previous program knowing your terminology is essential before starting this assignment. Write a program that consists of 4 functions.

1) start(): the starting execution point of the program. All instructions not defined in the other functions must be contained in the body of this function. The only executable instruction outside the body of a function is the call to run start function. This is similar to how the [second example] functional decomposition lecture example redesigned the [first example]. (Worth 1 GPA)

2) getInput(): the first function called by start(). It prompts and gets from the user a number (which can include a [rational] component). This number is then returned back to the caller (the start function). (Worth 1 GPA)

3) doubleIt(): the second function called by start(). Its input/parameter is the number returned by getInput() and it returns a double of the parameter. The doubled number is returned to start(). (Worth 1 GPA)

3) display(): the third function called by start(). Its input/parameter is the number returned by doubleIt() and this function displays that number to the console (text-based output) with two places of precision for the rational portion using a format specifier. (Worth 1 GPA)

Summary of functions to define:

Function name Inputs/parameters Return values Responsibility of the function
getInput() None Float (numeric assumed) Prompt for and gets the user to enter a number, return that number back to the caller of the function.
doubleIt() Float (numeric assumed) Float (numeric assumed) Take a number as a parameter, return the double of that number.
display() Float (numeric assumed) None Take a number as a parameter, display the number to the console (screen) with 2 places of precision.  In mathematics the precision of a number specifies the number of digits to right of the decimal.
start() None None Starting execution point of the program, contains the calls to the other 3 functions in the following order: getInput(), doubleIt(), display().  The only function that calls the other 3 functions is this function.

How to do determine 'how you did' on an assignment?

Program functionality (implementing working program features)

  • Test your program: Because the assignment description (along with required features) is posted ahead of time if you test your program thoroughly before submitting the final version then you should get a pretty clear idea of "how you will do".

Non -functional assignment requirements (style and documentation).

Although it won't affect your grade for mini-assignments you should still practice applying good style in your solution as well as writing documentation. It will keep your skills for the full assignments (when you will be graded on these things) and get you used to having good habits.

Marking and grading

Collaboration:

Assignments must reflect individual work; group work is not allowed in this class nor can you copy the work of others. Some "do nots" for your solution: don't publically post it, don't email it out, don't show it to other students.  For more detailed information as to what constitutes academic misconduct (i.e., cheating) for this course please read the following [link].

Method of submission:

You are to submit your assignment using D2L [help link]. Make sure that you [check the contents of your submitted files] (e.g., is the file okay or was it corrupted, is it the correct version etc.). It's your responsibility to do this! (Make sure that you submit your assignment with enough time before it comes due for you to do a check). If don't check and there were problems with the submission then you should not expect that you can "learn your lesson" and simply resubmit.

D2L configuration for this course

(Waived for fall 2022), Late submissions for full assignments  when there is no extension granted: Make sure you give yourself enough time to complete the submission process so you don't get cut off by D2L's deadline (or your submission will be automatically flagged as late by D2L and it will be graded appropriately)..

Submission received:

On time

Hours late : >0 and <=24

Hours late: >24 and <=48

Penalty:

None

-1 GPA

-No credit (not accepted)

General use of pre-created Python libraries:

Unless otherwise told you are to write the code yourself and not use any pre-created functions (or methods). For most assignments the usual acceptable functions include: print()input() and the 'conversion' functions such as int()float()str(). Look at the particular assignment description for a list of other functions/methods that you are allowed to use and still get credit in an assignment submission. If it's not listed then you should assume that you won't be able use the function and still be awarded credit.