代写 C algorithm math operating system graph software theory C Programming Language for MSc Laboratories

C Programming Language for MSc Laboratories
More on Assignment Practical Software Design
Introduction to Programming in C – Laboratories
Tautvydas Mickus – t.mickus@york.ac.uk Amir Dehsarvi – ad953@york.ac.uk

12 page report with these sections
• Requirements
• Analysis
• Specification
• Design
• Implementation Report
• Testing and Verification
• User Manual
2
Introduction to Programming in C – Laboratories
Tautvydas Mickus – t.mickus@york.ac.uk Amir Dehsarvi – ad953@york.ac.uk

• The report and assignment programs should be submitted electronically
• Mustusetheassignmentprojecttemplate
• Donotidentifyyourselfonthereportsorprogram listing
Use student Exam number
• DEADLINE:
Wednesday Week 3 Spring Term (22 January 2020): 12:00 noon
3
Introduction to Programming in C – Laboratories
Tautvydas Mickus – t.mickus@york.ac.uk Amir Dehsarvi – ad953@york.ac.uk

Software Development Model
1. Requirements
2. Analysis
3. Specification
4. Design
5. Implementation
6. Verification and testing
7. User Manual
Introduction to Programming in C – Laboratories
Tautvydas Mickus – t.mickus@york.ac.uk Amir Dehsarvi – ad953@york.ac.uk

Requirements (2 marks)
• State the requirements you have been given
▪ Explicit: the ones clearly stated in the assignment requirements
▪ Implicit: the ones that are implied by the assignment E.g. in C, Operating System, Graphics/midi/audio libraries…
Introduction to Programming in C – Laboratories
Tautvydas Mickus – t.mickus@york.ac.uk Amir Dehsarvi – ad953@york.ac.uk

Analysis (10 marks)
Aim: to understand at a high level what the program needs to do
Treat the program as a black-box, so don’t talk about program elements inside the box
User inputs to the box
Type of data input (key pressed expected, numbers/strings from keyboard) range of data
Outputs
Graphics, music, text to screen
Ranges (pixels, note pitch values, instruments…)
Analysis of processes and relevant mathematical formulas
e.g. Newtonian laws of bodies falling under gravity Methods of changing key, musical theory
Identify who will use the program
What knowledge are they assumed to posses?
Introduction to Programming in C – Laboratories
Tautvydas Mickus – t.mickus@york.ac.uk Amir Dehsarvi – ad953@york.ac.uk

Specification (3 marks)
Formal specification of what the program must do
Expands on requirements using analysis
E.g. draws a movable stick-man on the screen, able to launch a drawn projectile towards a target
Plays music using a number of user chosen instruments in a variety of keys and styles etc…
Explain what the program must do and what is optional
Do not talk about how the program is implemented
E.g. functions needed
Introduction to Programming in C – Laboratories
Tautvydas Mickus – t.mickus@york.ac.uk Amir Dehsarvi – ad953@york.ac.uk

Design (20 marks)
• What information is requested from the user and when
• Explain in detail what will be drawn on the screen (pixel ranges) and in what sequence and where or what notes will be played (pitch ranges)
• Describe what input from the user is expected and acceptable
• Explain how you will validate user input
Structure of program in terms of functions
• Draw a structure diagram showing the data flow between functions
• List functions that are required
• What data will they take, what will they do?
• Give a pseudo code description of important algorithms used
User interface design
Introduction to Programming in C – Laboratories
Tautvydas Mickus – t.mickus@york.ac.uk Amir Dehsarvi – ad953@york.ac.uk

Data Tables
Design (20 marks)
Specify a data table showing the name, type and value range of each important variables you will use.
Logical Flow
There should be a logical flow through your design, starting from the specifications and ending up at a full design for the program.
Refer to your specification
9
Introduction to Programming in C – Laboratories
Tautvydas Mickus – t.mickus@york.ac.uk Amir Dehsarvi – ad953@york.ac.uk

Structure Diagram and Function Table
Function
Arguments
Returns
Description
main
None
Default value (integer)
Driving function, calls all others, always returns 0
display_welcome
None
None
Displays the welcome message to the user
display_keys
None
None
Displays the instructions
for how to use the keyboard to the user
key_to_pitch
Key code (integer)
Pitch of note (integer) 0 if the key not valid
Converts a key number to a pitch, or to zero if the key wasn’t valid,
Introduction to Programming in C – Laboratories
Tautvydas Mickus – t.mickus@york.ac.uk Amir Dehsarvi – ad953@york.ac.uk

Pseudo code descriptions
function main
call display_welcome function call display_keys function begin loop
call getch to get a key from the user, put the result in key if key is zero then
call getch again, putting the result in key
end if
call key_to_pitch passing key, assigning the result to pitch if pitch is not equal to PITCH_INVALID
turn on a midi note of pitch, on channel 1 with velocity 64 pause for NOTE_DURATION
turn off a midi note of pitch, on channel 1
end if
loop while leave is equal to 0
end function main
Introduction to Programming in C – Laboratories
Tautvydas Mickus – t.mickus@york.ac.uk Amir Dehsarvi – ad953@york.ac.uk

Implementation Report (3 marks)
Give a table showing the source files and what they contain (functions, prototypes, global constants…)
The minimum number of files is three
.c file containing the main function
.c file containing all functions
.h file containing all defined constants and function prototypes
Document and justify design changes
Try not to make too many of these
Introduction to Programming in C – Laboratories
Tautvydas Mickus – t.mickus@york.ac.uk Amir Dehsarvi – ad953@york.ac.uk

Program structure (22 marks)
This should be nicely formatted and have consistent indentation
It should use #defines
E.g. global constants, preprocessor directives
It should use source code files
Headers, multiple source code etc
It should be well documented
Comments
Variable names
Function names
Lots of smallish functions Appropriate use of structures Appropriate use of pointers
Marks are deducted for explicit numerical values buried in the code and global variables
Use mouse handling and allegro keyboard handling
It should not be almost the same as programs on the website!
Introduction to Programming in C – Laboratories
Tautvydas Mickus – t.mickus@york.ac.uk Amir Dehsarvi – ad953@york.ac.uk

Testing and Verification (5
Test strategy
marks)
How you designed your program so that it works correctly under all run-time conditions
Test input-output data
include all test input data and test results comment on your test coverage
Modifications
detail any modifications you made following test failure and show the results of re-testing.
Introduction to Programming in C – Laboratories
Tautvydas Mickus – t.mickus@york.ac.uk Amir Dehsarvi – ad953@york.ac.uk

User Manual (7 marks)
Identify the intended user
You identified in your analysis
Write the manual with this user in mind
Your user manual should include:
Installation instructions
This may just be copying the executable file for your program;
System requirements
What type of computer is necessary to run the program? What kind of expertise you are expecting the user to have?
Usage Instructions
Explain all your programs features and how to use them Ideally with examples
Frequently-asked questions (FAQs)
Introduction to Programming in C – Laboratories
Tautvydas Mickus – t.mickus@york.ac.uk Amir Dehsarvi – ad953@york.ac.uk

General Issues (13 Marks)
• Is the program reasonably concise and efficient (2)
• Isitmature(2)
• ReportPresentation(2)
• Innovationandsophistication(7)
Introduction to Programming in C – Laboratories
Tautvydas Mickus – t.mickus@york.ac.uk Amir Dehsarvi – ad953@york.ac.uk

Executable Program (15 marks)
• Doesitmeetthespecification?
• If not what aspects are missing? • Isitinnovative?
• Doesitworkwell?
Introduction to Programming in C – Laboratories
Tautvydas Mickus – t.mickus@york.ac.uk Amir Dehsarvi – ad953@york.ac.uk

Using extra features of allegro
There are two appendices on using mouse control and simulating multiple events
• Appendix D Code: mouse.c
executable: mouse.exe
• Appendix E Code: events.c
Executable: events.exe
Introduction to Programming in C – Laboratories
Tautvydas Mickus – t.mickus@york.ac.uk Amir Dehsarvi – ad953@york.ac.uk