I'm making a pipe friction loss calculation tool
Hello, the system I am trying to make, the calculation tool, is the pipe friction loss calculation, but I could not do it. Can anyone help me with this?
![No description](https://cdn.answeroverflow.com/1263059299328856144/Ekran_goruntusu_2024-07-17_120339.png)
![No description](https://cdn.answeroverflow.com/1263059299673047080/Ekran_goruntusu_2024-07-17_120501.png)
![No description](https://cdn.answeroverflow.com/1263059300025372752/Ekran_goruntusu_2024-07-17_120508.png)
21 Replies
but you kinda have to tell what is not working
izle şimdi
When I try to calculate it, it gives an error. Some of the values are not the same as those on the website. What I want to do is that when the same values are entered as on the website, the result is the same. The code is very faulty, that's why.
site link
Boru Sürtünme Kaybı Hesabı
Boru Sürtünme Kaybı Hesabı
make a unit test
make the function that computes the result of the calculation static (and pure)
then test it with the inputs from the image
if that works, you'll know the problem is with how your ui parses inputs
or how it displays the result
I will share the codes and form with you tomorrow, I hope I can do it.
As I said, I am making a program to calculate pipe friction loss, but I could not solve the problems. When I try to calculate, it gives this error. What is the reason for this? Here are the codes.
@Anton @boiled goose
What does the error say in english
Don't switch on strings, make enums for everything. Then you will be able to move that logic to the static function I mentioned
Error: Input string is not in the correct format.
I mean, you can switch on them, but you should convert them to enums, and then switch on enum / use them to index an array of constants
I do not know how to do it
You maybe want to argue that you don't need the enum, but it's just way easier to see what values you can actually provide it
The form parses data and calls
Then make a unit test that does
Don't do this. Don't let your constants appear in two places
Your strings should be in an array, if you're going to need to do some action on each of them
But you still need access to individual constants to initialize the lookup
Here, you either have to do a custom type, that has a field for each of the constants, and is enumerable
Or make an array and lookup by index (enum casted to int)
This pattern is really really common, and I see few people actually doing the right thing
As is, your methods aren't even static for some reason
The least you can do is make them static and test them separately
help
![No description](https://cdn.answeroverflow.com/1263575645645176924/Ekran_Goruntusu_113.png)
You're probably using .net framework
use .net
not .net framework
I looked at the zip file, can you help me?