I won't be asking for a source code yet. What I need to figure out is the process of a certain Math problem with the equation that seemed to be impossible to be converted to source code.
Here it goes:
A certain waveform is 0 volts for time less than 2 seconds and 3 volts for time equal to or greater than 2 seconds. (These waveforms are referred to as step functions.) Prompt the user accepts time in the variable named time and displays the appropriate voltage, depending on the input value.
So the problem is asking for a program for voltage/seconds relation. The user inputs any duration (in seconds) and it is supposed to display the appropriate voltage.
This problem, I guess, is an example of step/greatest integer function, having the equation y= n<=x or where n is the greatest integer less than or greater than x. Step function also follows the equation y=[[x]].
So if a user inputs 5 seconds, it should display 6 volts. If a user inputs 9 seconds, it should display 12 volts.
So...how do I convert the equation to a proper process for source code?