C# Program for Score and Discount Calculation
C# Program for Score and Discount Calculation
The program checks if all scores are above 75 to grant a 'Distinction'. Conversely, if any score is below 50, it indicates 'Needs Improvement' .
Membership type dictates the discount rate, with Silver members eligible for a 5% discount on orders over $100, Gold 10% on orders over $200, and Platinum 15% on orders over $300. Additionally, a 10% discount applies for orders over $500, combining with the membership discount, significantly affecting total savings a user can achieve .
The program prompts for a number between 1 and 15, repeatedly until a valid number is entered. This ensures the table fits the expected size range, preventing unrealistic or cumbersome outputs and potential performance issues with large tables .
Conditional statements control the execution path by evaluating test scores and determining distinctions, performance improvement needs, and grade assignments. They ensure that only appropriate responses are triggered based on precise input conditions, emphasizing the correct logical flow and preventing incorrect output. This significantly impacts program outcomes by allowing for responsiveness and adaptability based on user-provided data .
An item's price is accepted if it is a positive double value. The program uses a loop to request input until a valid price is entered, providing feedback if the input is invalid or non-positive, to ensure only legitimate prices are used in calculations .
The program uses a loop to repeatedly prompt the user for input until a valid score is entered. A score is considered valid if it is a non-negative double value. This is important to ensure that only legitimate scores are processed, preventing errors in calculations or outputs .
The program employs input validation within a loop to check each entered score. If a score is negative, it prompts the user with a message specifying that scores cannot be negative and requests re-entry until a valid score is provided. This ensures data integrity by preventing negative values from affecting the program's logical operations .
The file saving functionality allows users to preserve the multiplication table for future reference, which can be useful for educational purposes or documentation. The program uses a StreamWriter to save the table as a text file named with a timestamp, ensuring each file is uniquely identified .
The program calculates a student's average test score by summing three individual scores and dividing by three. It then assigns a grade based on the following conditions: if the average is 90 or above, the grade is 'A'; if 80 or above, 'B'; if 70 or above, 'C'; if 60 or above, 'D'; otherwise, the grade is 'F' .
Different discount rates incentivize different levels of spending based on membership benefits. The program assigns a 5% discount for Silver members with a total cost over $100, 10% for Gold with over $200, and 15% for Platinum with over $300. Additionally, if total cost exceeds $500, an extra 10% discount applies. This is implemented using conditional statements that check membership type and total cost .