Skip to content

Course home

Programming concepts

Programming concepts

EasyMediumHard
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
Question 32

A drone flight monitoring system is writing a program to calculate a drone's remaining battery energy reserve (in Wh) across a flight consisting of three separate segments. The total capacity of the battery is 500 Wh.

If any high-wind gusts are encountered during the flight, the remaining energy reserve is further reduced.

Write a VB.NET program to calculate the final remaining energy reserve.

You should assume there are three integer variables called s1, s2, and s3 which have already been declared and given values representing the energy consumed (in Wh) during each of the three flight segments.

The program should:

  • Get the user to enter the number of high-wind gusts encountered and store this number in a variable
  • Calculate the remaining energy reserve (starting with a total capacity of 500 Wh and subtracting the energy consumed in the three segments)
  • If exactly one high-wind gust was encountered, the remaining energy reserve is reduced by 40 Wh
  • If more than one high-wind gust was encountered, the remaining energy reserve should be divided by 3
  • The remaining energy reserve must not be less than 0
  • Return/output the final calculated remaining energy reserve

You should use meaningful variable name(s) and VB.NET 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