Reading the Input Data

The solution of this problem,like the previous one can also be splited into three parts – reading input data , processing and outputting the result.

We start again with the choice of appropriate data types and names of the variables. For the Lilly's years (age) and the unit price of the toy (presentPrice) in the description is given, that they will be integer numbers. That's why we will use int type. For the price of the washing machine (priceOfWashingMachine) we know, that it is real number and we choose double. Of course, we can skip the explicit specification of type, by using var. In the above code we declare and initialize (assign value) the variables.

results matching ""

    No results matching ""