0

Who can solve my kotlin first project? i am failed many times i can't understand it

Help me

3rd Dec 2021, 6:03 PM
Ytbarek Debalke
38 Answers
+ 2
Each day a family consumes 15 liters of water. Given the number of years as input, you need to calculate and output the amount of water consumed in that period. Sample Input 5 Sample Output 27375 The water consumption in 5 years would be: 5*365*15 = 27375
3rd Dec 2021, 6:07 PM
Ytbarek Debalke
+ 2
Ytbarek Debalke looks like you don't know programming nor kotlin. First learn the concepts then you can easily write the program.
3rd Dec 2021, 6:34 PM
Kashyap Kumar
Kashyap Kumar - avatar
+ 2
Ytbarek Debalke Yes, Kashyap Kumar ⭕ is right. Learn the concepts first, very carefully, as many times till you understand it well. Also learn basic syntax of the language.👍Just try hard👍
3rd Dec 2021, 6:38 PM
(☞ ಠ_ಠ)☞.ρrΑτΗαΜ.
(☞ ಠ_ಠ)☞.ρrΑτΗαΜ. - avatar
+ 1
A͢J - S͟o͟l͟o͟H͟e͟l͟p͟e͟r͟ Your Reply 8-9 min before was really funny😂😂
3rd Dec 2021, 6:17 PM
(☞ ಠ_ಠ)☞.ρrΑτΗαΜ.
(☞ ಠ_ಠ)☞.ρrΑτΗαΜ. - avatar
+ 1
Thank you i tried and i was closed thanks to all of you i will try hardly and i solve it
3rd Dec 2021, 6:41 PM
Ytbarek Debalke
+ 1
Ytbarek Debalke The number of years. That's in the challenge description. So, take the number of years as an user input, then use it in the formula. But, from the talk above, you do need to study better programming concepts. This is way more important than the languages themselves. When you get the concepts, you can code in any language. Before that, you'll bang your head to the wall on every simple question, like this one.
4th Dec 2021, 3:50 AM
Emerson Prado
Emerson Prado - avatar
+ 1
Ytbarek Debalke Looks like you understand the math involved in the question just fine. However, writing a good program involves more than just solving the problem for one particular input case. You need to be able to give the solution no matter what value the user inputs as long as the input is valid of course (a numeric input not a text input). You put in println(2*15*365) which gives the number of litres after 2 years but what if the user wants the number of litres after 7 years or any other number of years. The way you've written your code you'd have to change your code for every single input value your user wants to input. You need to read an input value for number of years from the user of your program and use that value to calculate the output that you need. This is one of the basic requirements for a program. It should be able to take whatever input the user gives, decide if it's valid input and if it is, calculate the output. Once your program can do that you'll be able to get past this project.
5th Dec 2021, 4:23 AM
Macross-Plus
Macross-Plus - avatar
0
Show your attempts water consumption: 15 litre/day then in n year? where n is input 1 year = 365 days.
3rd Dec 2021, 6:04 PM
A͢J
A͢J - avatar
0
Ok wait me
3rd Dec 2021, 6:06 PM
Ytbarek Debalke
0
Here it is
3rd Dec 2021, 6:07 PM
Ytbarek Debalke
0
Ytbarek Debalke This is the problem not your solution. Where is your solution?
3rd Dec 2021, 6:08 PM
A͢J
A͢J - avatar
0
fun main(args: Array<String>) { var years = readLine()!!.toInt() }
3rd Dec 2021, 6:09 PM
Ytbarek Debalke
0
This is the code
3rd Dec 2021, 6:09 PM
Ytbarek Debalke
0
Ytbarek Debalke This code is already given. Where you are getting problem to understand? It is simple. Water consumption: 1 day = 15 litre Then in n years = ? //Where n is input How many days in 1 year?
3rd Dec 2021, 6:12 PM
A͢J
A͢J - avatar
0
365
3rd Dec 2021, 6:13 PM
Ytbarek Debalke
0
I think You can't solve it
3rd Dec 2021, 6:19 PM
Ytbarek Debalke
0
Ytbarek Debalke Why should we do? Even I already explained you. 1 year = 365 days 1 day = 15 litre Then 365 days = ? litre
3rd Dec 2021, 6:24 PM
A͢J
A͢J - avatar
0
So, how can i add in my code
3rd Dec 2021, 6:26 PM
Ytbarek Debalke
0
Please help me you are a good person in this programming language
3rd Dec 2021, 6:27 PM
Ytbarek Debalke
0
Ytbarek Debalke You have completed 88 % of kotlin course. Still asking how to do that. 1 day = 15 litre 365 days = 15 * 365 For n years (where n is input) = n * 15 * 365 This is just a simple multiplication.
3rd Dec 2021, 6:31 PM
A͢J
A͢J - avatar