安徽之窗|安徽信息网
当前位置: 安徽视窗 > 新闻

代写BIT 1400编程、c++编程调试、代写

来源:安徽视窗    发布时间:2020-11-24 12:07   作者:feitian   

代写BIT 1400编程、c++编程调试、代写

Assignment 9 – Grade Calculator & Review

BIT 1400 Fall 2020

Objective:

Calculating your final grade (you can use this program to check your final grade) ends up

touching on strings, file I/O, structs, static arrays, loops and functions; all the content of exam 2.

Thus, don’t think of the assignment as extra work; you can think of it as preparing for the

exam…this also means you shouldn’t protest having an assignment at the same time as the

exam.

Important Note: we have done much of the work for this assignment already. Grab code from

your A6 and A8 submissions or use the provided solutions. That will not be considered cheating.

Submission:

• You will make a new .cpp file that you will submit (or modify the starter code below)

• If using the starter code, it should run and “work” before you modify it.

• Make sure your final program compiles and works.

• Be sure to include tests and comments in your code. You can make multiple different

.txt files to read in (it will be better for testing your code). In that case submit both your

.cpp and these test files in a .zip file.

• Save the .cpp file as A9_CalcGrades_<Name>_F20.cpp where name is your first initial

and last name. Eg: A9_CalcGrades_DSprague_F20.cpp

• Submit your .cpp file or your .zip file to cuLearn before the deadline.

• Remember that you can submit your assignment multiple times before the deadline. We

will only grade your last submission. Therefore, you can submit partial work to make

sure you don’t run out of time.

Grading:

Part 1: Code Running (50 pts)

• Code compiling and running correctly including reading in the given .txt file (10 pts)

o The .txt file can be found here: https://drive.google.com/file/d/1lo8P8A5tO6pBZIxaPCwGRSuysokg0_Q/view?usp=sharing

• The file with the grades is successfully read in (10 pts).

• The grades are successfully stored in structs (10 pts).

• The percentage of the final grade calculated for each course deliverable works as

expected (10 pts).

• The final grade is calculated and gives the expected results (10 pts)

Note: the TAs have the right to change the input file to have a different number of assignments

or quizzes. Some course deliverables may also be missing. You can assume this will result in a 

mark of 0 for the missing deliverable. You are trying to make your program as generalizable as

possible.

Part 2: Code quality (50 pts)

• Overall code quality (10 pts)

• Code format and readability (10pts for all functions)

o Code formatting and readability includes indentation and code layout.

• Appropriate comments and variable names (approx. 5pts per function, 20 pts total)

o Note this is for appropriate comments. A comment like “Declares a variable X” is

not helpful at all. Will your TA know exactly what the code is doing immediately?

If not, you should put a comment. I saw a number of excessive comments in

prior assignments.

• The code is logically correct without potential bugs (10pts total)

PROVIDED CODE:

Feel free to use the provided code to help simplify the assignment or use it as an example how

to parse strings.

https://drive.google.com/file/d/1wfPOEUpGJJZRdNYPe-FUAIvL9D-mKBtB/view?usp=sharing

Here is a sample text file to read in:

https://drive.google.com/file/d/1lo8P8A5tO6pB-ZIxaPCwGRSuysokg0_Q/view?usp=sharing

Questions:

Start

Remember to make a blank project, add a new .cpp file that contains the main method, and

then iteratively code/compile/test. You can also start with the provided starter code if you

prefer. You are expected to test all functions you write and write comments in your code to help

explain your work.

Copy the text test file Grades.txt to the course code directory (where your .cpp file is located)

and then

1. right-click the resources files folder in your Solution Explorer window,

2. select Add Existing

3. and add the text file to the project.

https://drive.google.com/file/d/1lo8P8A5tO6pB-ZIxaPCwGRSuysokg0_Q/view?usp=sharing

Make sure the file is in the same directory as your .cpp file.

Feel free to use the provided starter code which defines several functions for you. It will also

save you time from having to write many of the function comment blocks. I personally believe

using the starter code will make the task easier.

https://drive.google.com/file/d/1wfPOEUpGJJZRdNYPe-FUAIvL9D-mKBtB/view?usp=sharing

Task 1: Read in the text file.

Make sure you grab your code from A6 and A8. Your job is to write a function that reads in the

contents of a .txt file.

• For each line of the text (use fgets), the format would be: <Evaluation

Type>,<Grade1>,<Grade2>,…

• Extract the evaluation type and the grades from the line, then pass this information to

function updateGradeSet (see in task 2).

• Grades should be stored in a DYNAMIC array…..dynamic arrays are not on exam 2 but

are extremely important to learn. They were discussed in last week’s scheduled lectures.

• You should not make any assumptions about white spaces or the number of grades per

line. If the line has 0 grades, then the student gets a 0 for that evaluation type.

Hint:

• You cannot directly use the file reading code from A8 since the fields will be different but

much of that code (getting each field) will be the same.

• You will want to use the function atoi or atof to convert text to a number.

• You don’t really know where the end of the line is and the delimiter is a comma ‘,’ so

fscanf won’t work.

• If you get stuck in this step notice the provided main function has a huge chunk of

commented out code. This is code to make the grade data in code (rather than reading

from a file). Only use this if you can’t get Task 1 off the ground.

Task 2: Define updateGradeSet

If you are using the provided code, then you need to define the following function:

void updateGradeSet(GradeSet1400* p_toMod, char* a_gradeName, int*

a_grades, int numGrades);

(The following corresponds to the PROVIDED CODE. If you write the code yourself you will

probably have to take a similar approach)

• The function updateGradeSet takes a pointer p_toMod to a GradeSet1400 and modifies

one variable in p_toMod.

o For example, if a_gradeName is “QUIZ” then we call createGradeData to create

a DGrades1400 struct (the D stands for dynamic) that stores all information

about quizzes. We then save that struct to p_toMod.

o In the provided code, p_toMod->quizzes means we access the quizzes variable

in the grade set. The “->” works like the ‘.’ when using a struct (eg

“toMod.quizzes”) but for pointers. We cover this in the pointers’ lectures (the

week of the exam). We just need to touch on this a little for this assignment.

Pointers are not on the exam.

• You will have to implement other conditionals for exam1, exam2, assignments, final

exam, and labs.

If you are not using the provided code, then your program should have read in the text file and

put all grades into the GradeSet1400 struct in some way. At the end of this task you should

have all the data necessary to calculate your final grade.

Task 3: Define calcTypeGrade

double calcTypeGrade (DGrades1400 grades);

Define a function calcTypeGrade that takes a DGrades1400 struct, calculates and returns the

final grade for that evaluation type.

Example 1: if the quizzes read in were “QUIZ,100, 100, 100, 100, 100,50, 50, 100, 100, 100,

100, 25, 25, 100, 100”

Grades (dynamic) array: {100, 100, 100, 100, 100, 50, 50, 100, 100, 100, 100, 25, 25,

100, 100}

Number of grades: 15

QUIZ_GRADES_COUNTED: 12

QUIZ_PCT: 0.05

• The top 12 grades would be {100, 100, 100, 100, 100, 50, 100, 100, 100, 100, 100, 100}

• The average of these top 12 grades would be 1150 / 12, which is 95.8…these last two steps

are already done for you if you take the code from A6.

• The student’s final mark (out of 5) on the quiz is 95.8 * QUIZ_PCT (0.05), which is 4.79.

Example 2: if the average assignment grade after dropping the 2 lowest is 80%, then the

assignment mark would be 80 * ASSIGN_PCT (0.3), which is 24.0.

Task 4: Define calculateGrade

int calculateGrade(GradeSet1400 grades);

Now write a function calculateGrade that takes a GradeSet1400 and returns you final grade for

the class (out of 100).

This function should simply need to call calcTypeGrade numerous times and sum the results.

Don’t get cute: Call calcTypeGrade even if there is only 1 grade in the DGrades1400. If all the

evaluation types use the same structure you can keep using the same function.

(simple) Task 5: Miscellaneous

• Make sure you free any dynamic memory you requested. This was done for you but

commented out. Make sure freeGradeData is correct.

• Optional: Notice the function calcLetterGrade has not been defined. You can define it to get

the course letter grade based on the grade percent.

• Extra practice for exam2: not explicitly in this assignment but make sure

a) you can write a ternary expression, switch statement and do-while loop

b) you can debug and reason about code

c) You should continue to know about binary, hex, 2s complement, and pseudocode

d) Make sure you write tests for your code to show you know what kinds of cases you

might enco如有需要,请加QQ:99515681 或邮箱:99515681@qq.com 微信:codehelp

站点精选

治国理政新实践·安徽篇,全民“创城” 让宜城更美好
治国理政新实践·安徽篇,全民“创城” 让宜城更美好

2015年,安徽省安庆市在拿下省级文明城市称号后,首次获全国文明城市提名并启动全国文明城市创建工作,自此,该市踏上了三年一个周期的“创城”征程。2016年,安徽...