Calculate the course average across all students

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

Assignment Details

Carefully follow the directions below to prepare the necessary solution files. When you have completed the assignment, submit the following files through the course Moodle:

- courseBuddy.cc - all source code for your program
- README.txt - external documentation for your program (see instructions in section 3.5)

Remember to put your name, student number and NSID at the beginning of any files you are submitting. For any C++ code files, include this information using code comments.

1.1 Special Directions

Your solution to this assignment should be developed on tuxworld using the bash shell. Your submission will be marked in this environment.

2 Introduction

For this assignment, you will be developing a more comprehensive version of the "Course Buddy" program introduced in assignment 1. In particular, we want to build a program which keeps track of all the students in a course and the grades they have achieved based on the program requirements below. You will use procedural C++ to write this program, meaning your program will closely resemble programming in C.

Programming in Procedural C++
Note the following specific notes and restrictions on using "procedural C++":

- Unlike C++, C does not have a real Boolean type and does not allow you to declare variables in your programs except at the beginning of functions. You are permitted to use the bool type and to declare variables anywhere you need in your file as C++ permits.

- Unless otherwise specified, you are not permitted to use any of the object-oriented features of C++. This includes using cin, cout and cerr to read and write to the console. Instead, make use of the printf(3) and scanf(3) families of functions from the C stdio.h library.

- You may use either the C or C++ methods for requesting memory dynamically. Choose one method and stick with it for your entire program. I suggest beginners use the C++ keywords new and delete to create and destroy dynamic memory, however students looking for a challenge may wish to use the C standard library functions malloc() and free().

We are essentially writing C programs, but compiling them using the C++ compiler. This choice was made to simplify some of the challenges of working in C which can make it difficult for beginners to write code with good style. If you would like any clarification as to whether a C++ feature is available or not for this assignment, ask on the forums or consult with the instructor.

Description of Course Buddy

Course Buddy will be the focus of this assignment and the next assignment. The work you do on this assignment will carry through to the next assignment. Below is a description of the features this program will have by the end of the next assignment, but not necessarily by the end of this assignment.

Course Buddy is a program which keeps track of all the students in a course and the grades they have achieved. It is helpful to outline some assumptions made about the types of courses it can represent:

- All information is stored in a "volatile" format meaning that all information is lost when the program terminates. This implies that every time the program is launched the user starts with an empty database.

- The following data is tracked for each student: student ID, name, assignment grades, exam grade and final course grade.

- Each student is uniquely identified by their student ID, which allows two students to have the same name. Student IDs start at 0 and increment by 1 as new students are added. Students are added dynamically by the user.

- An arbitrary number of assignment grades can be tracked for each student provided that all students were assigned the same number of assignments. The number of assignments is hard-coded in the source code, not determined by the user.

- Each assignment is uniquely identified by its assignment ID ranging from 0 to the number of assignments minus 1.

- Only one exam grade is tracked for each student.

- A student's final grade can be calculated by the following weighted sum: 50% exam and 50% assign- ments, where each assignment is worth an equal amount.

- Assignment and exam grades are entered as whole number percentages. The final course grade and calculated averages may be floating-point values.

- There is a fixed maximum number of students which can be added to the system over the course of the program's runtime, also hard-coded in the source code.

A user can perform the following actions using Course Buddy:

- Add and remove individual students
- Print out all information for a specific student
- Print out all information for all students
- Update the assignment and exam grades for a specific student
- Calculate the student's final grade based on the assignment and exam grades
- Calculate the course average across all students for an individual assignment, the exam or the final course grade
- Import student data from a file (next assignment)

For this assignment, you will not worry about building an intuitive user interface for Course Buddy. The user interface will come later in the next assignment. Your focus will be on the process of developing the necessary functions incrementally and writing tests for those functions.

3 Assignment Requirements
This section contains specific details outlining how your program should implement the program described in section 2.

Data Types
You will need to define an appropriate data structure named student to contain data for each student. Within your structure, carefully select the most appropriate data type for each component (student ID, name, assignment grades, exam grade and final course grade) based on the program description above.

You will also need to define global variables and constants as appropriate. For example, you may want to create a global array containing a list of pointers to all the students in your database.

Functions
You must define the following functions based on the provided function headers. Preserve the given function names, parameter types and return types to make marking easier.

student* allocateStudent(char* name) - dynamically allocate space to store one student with the given
name and initialize all its values sensibly

bool deallocateStudent(int id) - delete the given student and free up any allocated space that student's record was using

bool gradeAssignment(int student_id, int assignment_id, int grade) - adjust the grade for the given assignment for the given student

bool gradeExam(int student_id, int grade) - adjust the given student's exam grade

bool calculateFinal(int id) - calculate the given student's final grade

float getAssignmentAverage(int assignment_id) - calculate the course average for the given assignment

float getExamAverage() - calculate the course average for the exam

float getFinalAverage() - calculate the course average for the final course grade

void printStudent(int id) - print all information about one student

void printAllStudents() - print all information for all students

Note: most functions should have a designated return value if an error occurs. Functions returning bool
types should return false, functions returning memory pointers should return NULL, etc.

Coding Process
The purpose of this assignment is to give you an opportunity to practice the software development techniques introduced in the lectures. For our purposes, it is more important to show evidence that you understood the techniques seen in the lectures than it is to produce a practical software product. You are to develop Course Buddy following the principles of Test-Driven Development (TDD) outlined and demonstrated in the lectures.

TDD is summarized by the flowchart on slide 26 of lecture topic 10. For each function above, you should start by writing a stub function which consists of the function header and a return statement which initially returns an arbitrary value. Next, write a unit test for that function within your main() function which tests functionality that has yet to be implemented. This test should initially fail. Now write just enough production code for your function to pass the test. Alternate between writing unit tests and writing just enough code for the test to pass until all necessary functionality is present.

When writing your unit tests, keep the principles of testing introduced in lecture topic 9 in mind: boundary conditions, defensive programming, white box vs. black box testing and maximizing test coverage. Keep your tests simple, varied and thorough. Remember that unit tests should be silent unless they encounter errors. Use assertions in your unit testing where appropriate.

When writing your functions, remember to check the pre- and post-conditions. If you encounter an error, carefully choose the least disruptive way to inform the user. For example, if your function receives a value which is out of range and the error is not critical for your program to run, consider returning an "error" value rather than using an assertion.

Surround your unit tests in your main() function with #ifdef TESTING and #endif // TESTING which will allow you to compile your program with or without your unit tests.

Remember the principles of good programming style (lecture topic 5) and defensive programming (lecture topic 8) as you implement Course Buddy. Some important considerations for when your work is evaluated:

- Keep all lines of code shorter than 100 characters long.
- Choose appropriate variable and function names.
- Use a consistent indentation style.
- Comment your code when appropriate. Follow the programming guidelines for templates discussed in lecture topic 10.

Compilation and Execution
Your program must compile without errors or warnings using the following commands to the compiler:

- g++ -Wall -Wextra -o courseBuddy courseBuddy.cc
- g++ -Wall -Wextra -DTESTING -o courseBuddy.testing courseBuddy.cc

When executing your regular courseBuddy program, there should be no output and your program should terminate successfully. When executing your courseBuddy.testing program which contains your unit tests, each unit test should be executed and the program should terminate successfully only if no errors were identified.

Reference no: EM131527236

Questions Cloud

What is the modern age : What is the Modern Age and did it begin with the creation of the Mongol Empire? Write reports on the role Genghis Khan played in the expansion
Do you believe sleep murder is possible : On Consciousness and Its Variations, do you believe sleep murder is possible? Provide specific research, articles, etc to support your stance.
Providing a safe environment : If management is going to "play the emotional card" with employees is there a right and wrong way to do it?
The price that this bond trades for will be closest : Assuming the appropriate YTM on the Sisyphean bond is 1111?%, then the price that this bond trades for will be closest? to:
Calculate the course average across all students : Calculate the course average across all students for an individual assignment, the exam or the final course grade
What adjustment for unearned revenue did microsoft make : For the years ending June 30, 2004 and 2003, Microsoft Corporation reported short-term unearned revenue of $6,514 million and $7,225 million, respectively.
Statement for organizations growing and responding to change : Discuss the relevance of this statement for organizations growing and responding to change. What responsibility does a leader have to honor stakeholder concerns
Analyze carl rogers from freud''s psychoanalytic perspective : Analyze Carl Rogers from Freud's psychoanalytic perspective. Analyze Carl Rogers from two other theoretical perspectives studied.
Determine the amount of net income for a period : At the end of February, the first month of the business year, the usual adjustment transferring rent earned to a revenue account from the unearned rent account.

Reviews

len1527236

6/12/2017 1:49:06 AM

• Take special care when comparing equality between floating-point numbers. When performing floating- point arithmetic, your program is limited to the precision of the datatype used to store the operands and the result. For example, your program may report an average as 66.667% when you are expecting 66.666%. • You may define other functions than the ones mentioned above if you feel it is necessary. • A good way to get started on this assignment is to create stub functions for all the functions you will be writing. Define all the datatypes, constants and global variables you think you will need early. Write usage templates for all your stubs and custom datatypes before you begin writing code. • If you get stuck, reach out for assistance early. In addition to your C++ reference resources, consult with the tutorial leader, other students and the instructor if you are not sure what to do next.

len1527236

6/12/2017 1:48:39 AM

Read through attached file for details and instructions - You may define other functions than the ones mentioned above if you feel it is necessary. In addition to your C++ reference resources, consult with the tutorial leader, other students and the instructor if you are not sure what to do next.

Write a Review

C/C++ Programming Questions & Answers

  Create program that uses functions and reference parameters

Create program that uses functions and reference parameters, and asks user for the outside temperature.

  Write a program using vectors and iterators

Write a program using vectors and iterators that allows a user to maintain a personal list of DVD titles

  Write the code required to analyse and display the data

Calculate and store the average for each row and column. Determine and store the values for the Average Map.

  Write a webservices application

Write a webservices application that does a simple four function calculator

  Iimplement a client-server of the game

Iimplement a client-server version of the rock-paper-scissors-lizard-Spock game.

  Model-view-controller

Explain Model-View-Controller paradigm

  Design a nested program

How many levels of nesting are there in this design?

  Convert celsius temperatures to fahrenheit temperatures

Write a C++ program that converts Celsius Temperatures to Fahrenheit Temperatures.

  Evaluate and output the value in the given base

Write C program that will input two values from the user that are a Value and a Base with which you will evaluate and output the Value in the given Base.

  Design a base class shape with virtual functions

Design a base class shape with virtual functions

  Implementation of classes

Implementation of classes Chart and BarChart. Class barChart chould display a simple textual representation of the data

  Technical paper: memory management

Technical Paper: Memory Management, The intent of this paper is to provide you with an in depth knowledge of how memory is used in executing, your programs and its critical support for applications.

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