159.101 Instructions for Assignment 2
Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit
159.101 Instructions for Assignment 2
Check the due date on Stream. Always plan to complete assignments a few days early. That way you will have extra time if something unexpected happens to slow you down.
It is a good idea to put your name andID number in a comment at the top of your program. Refer to the notes up to and including section 4.
At a diving competition, the mark given to each diver is awarded as follows. There are a number of
judges and each judge gives a mark. The final mark is found by leaving out the highest and lowest marks and calculating the average of the rest ofthe marks. Write a C++ program that reads in the number of
judges at the competition and then reads in a mark for each judge. Perform the necessary calculations, and display the final mark.
The following data checks must be carried out in the program:
• the number of judges must be from 4 to 8 inclusive
• each judge must give a mark between 0.0 and 10.0 inclusive (a real number that may include decimal fractions)
If an invalid value is entered (for number of judges or for the mark), the program must ask for an acceptable value to be entered instead.
Example 1:
Enter number of judges: 2
Invalid. Enter number of judges again (4 to 8): 4
Enter mark for Judge 1: 3.5
Enter mark for Judge 2: 6.0
Enter mark for Judge 3: 6.0
Enter mark for Judge 4: 9.75
Final mark: 6.00
Example 2:
Enter number of judges: 5
Enter mark for Judge 1: 10.0
Enter mark for Judge 2: 13.75
Invalid. Enter mark again (0.0 to 10.0): 9.0
Enter mark for Judge 3: 3.0
Enter mark for Judge 4: 9.25
Enter mark for Judge 5: 8.8
Final mark: 9.02
Notes:
1. Your display should be similar to the examples above.
2. Remember to test your program with several different examples.
3. Remember to test what happens if invalid data is entered.
4. The final mark must be displayed with one or two decimal places. For example, do not display 6 or
6.000 but you can display either 6.0 or 6.00
Some general notes about the assignments in 159.101
• You submit your assignments via Stream (under Assessments) before the due date and time
• The due date and time appear on the Assignment under Assessments (where you submit)
• For Part 1 of the assignment, submit yourGenerative AI use statement. You must type in your name and if you used AI all prompts and AI responses. Assignments without a completed AI use statement will not be marked.
• Part 2 of the assignment will appear only once theGenerative AI use statementhas been submitted in Part 1. For Part 2, submit only your .cpp file. No other file types will be accepted.
• Staff are not available to check your assignment before you submit it.
• Do not rush into submitting an assignment. You may find useful information in the notes during the week after the assignment starts.
• Assignments may use C++ knowledge from 159.101 only.
IMPORTANT rules for assignments in 159.101
• You may get assistance when writing an assignment. Assistance includes asking questions and getting ideas from teaching staff and other students. Assistance also includes asking for help when your program is not working correctly and you cannot find the error.
• You may NOT use AI to write your assignment for you. See “AI usage for 159101 Applied Programming” . If you use AI to write some or all of your assignment you will lose some or all marks for the assignment.
• You may NOT get someone else to write your assignment for you. If you submit a program written by someone else, you will lose a significant amount of the marks for the assignment.
• You may NOT copy a program from the internet. If you submit a program copied from the internet you will receive ZERO marks for the assignment. It is very easy for markers to find the same program on the internet.
• The important thing is that you must show that you understand what is happening in the program you submit. Teaching staff will sometimes arrange zoom sessions with students to check that they understand their submission. If this happens to you, please do not be offended — it is something we have to do as part of the quality assurance for the course.
Working on your assignments in 159.101
• You need an editor/compiler to create and run your program. VSCode is provided (see notes to install VSCode under Week 0) but you can use any other IDE that supports C++.
• Build your program up gradually, for example you could start by working only with a fixed number of judges and no error checking. When this is working extend the program further.
• Give yourself plenty of time. Do not start on the day before the deadline!
• Do not give up just because the deadline arrives. You will still get some marks for a partial solution. In a difficult situation, you can apply for an extension.
Marking criteria for assignments in 159.101
Assignments are marked out of 10 and marks can be lost for:
• programs not compiling or running
• errors in code
• programs that have not been tested for a variety of situations
• programs that do not follow the instructions that are provided
• programs that appear to be written by someone else
• programs that are copied from the internet
• programs that do not follow the rule of using C++ knowledge from 159.101 only.
2025-09-10