An aerospace engineering firm is testing the electrical systems of an unmanned aerial vehicle (UAV). They require a program to track the battery cell voltage levels (in Volts) recorded during successive flight simulation cycles.
An operator enters the voltage levels one by one. The operator enters -1 when they are finished entering data.
The algorithm must:
-1, are invalid and should not be counted or processed).Here is a sample execution sequence:
Enter battery voltage in Volts (-1 to quit): 14.8
Enter battery voltage in Volts (-1 to quit): -0.5
Error: Voltage must be positive.
Enter battery voltage in Volts (-1 to quit): 11.2
Enter battery voltage in Volts (-1 to quit): 15.1
Enter battery voltage in Volts (-1 to quit): -1
Write an algorithm to meet these requirements.
Use pseudocode or a programming language with which you are familiar.
50 exam-style questions on Edexcel GCSE Computer Science Constructs, covering Structural components of programs and Writing programs with control constructs. Each one has a worked solution and a mark scheme showing where the marks go.