Skip to content

Course home

Programming concepts

Programming concepts

EasyMediumHard
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
Question 26

An eco-friendly courier service tracks a driver's daily carbon emissions savings (in grams of CO2) across three delivery routes.

If a driver commits any traffic violations during their routes, their final emissions savings are reduced.

Write a C# program to calculate the final emissions savings.

You should assume that three integer variables called trip1, trip2, and trip3 have already been declared and assigned values representing the carbon savings of the three individual routes.

Your program should:

  • Prompt the user to enter the number of traffic violations committed and store this in an integer variable.
  • Calculate the total carbon savings across the three trips.
  • Apply the following penalty rules:
    • If exactly one violation was committed, the total savings are reduced by 50.
    • If more than one violation was committed, the total savings are divided by 3 (using integer division).
    • Ensure the final total savings are never less than 0.
  • Output the final total savings with a suitable message.

You should use meaningful variable names and correct C# syntax in your answer.

[7]
Markscheme

Programming concepts Questions

  1. GCSE
  2. /Computer Science
  3. /Programming concepts

298 exam-style questions on AQA GCSE Computer Science Programming concepts. Each one has a worked solution and a mark scheme showing where the marks go.

Question bank