ahmedwaqas92
ODI Debutant
- Joined
- Dec 26, 2013
- Runs
- 10,582
- Post of the Week
- 4
Hey Guys!! ok so the task is very simple and extremely minuscule (for any half decent C programmer)
I need to write a program that will
1) Define an integer called 'factor' and place its value = 1.0
2) Store a value to another integer called 'x' (This is user input value)
3) Check to see if the input value is less than 500 if it is then 'x' multiplies with 'factor' and produces a result with another integer that will be used later.
4) If value of 'x' is > 500 then program should do (x - 500) = store in another integer let's say 'a', concurrently the program should also store (multiply 500 x 'factor' as well)
5) For 'a' the program should check if a < 700 if it is then it should reduce the 'factor' by 20% and multiply with 'a'.
6) If a > 700 then the program should do (a-700) = store the integer in 'b', concurrently the program should also store (multiply 700 x 20% reduced of 'factor')
7)The remaining value should then be multiplied with a 20% reduced factor of the factor reduction I did in step 5.
8) Loop this sequence (step 5-Step7) until x is less than 700 and we have a total based on that. (Factor needs to be reduced by 20% on the last stored value after every set of 700 for 'x' - until the loop finishes).
9) Once we have this figure based on whatever condition it suffices I need to add it to 'x' times 0.05 and output a result on the screen
P.S. This is a pricing model basically, just in case you were wondering.
Help Needed
Thanks Guys
Waqas
I need to write a program that will
1) Define an integer called 'factor' and place its value = 1.0
2) Store a value to another integer called 'x' (This is user input value)
3) Check to see if the input value is less than 500 if it is then 'x' multiplies with 'factor' and produces a result with another integer that will be used later.
4) If value of 'x' is > 500 then program should do (x - 500) = store in another integer let's say 'a', concurrently the program should also store (multiply 500 x 'factor' as well)
5) For 'a' the program should check if a < 700 if it is then it should reduce the 'factor' by 20% and multiply with 'a'.
6) If a > 700 then the program should do (a-700) = store the integer in 'b', concurrently the program should also store (multiply 700 x 20% reduced of 'factor')
7)The remaining value should then be multiplied with a 20% reduced factor of the factor reduction I did in step 5.
8) Loop this sequence (step 5-Step7) until x is less than 700 and we have a total based on that. (Factor needs to be reduced by 20% on the last stored value after every set of 700 for 'x' - until the loop finishes).
9) Once we have this figure based on whatever condition it suffices I need to add it to 'x' times 0.05 and output a result on the screen
P.S. This is a pricing model basically, just in case you were wondering.
Help Needed
Thanks Guys
Waqas