Need help! Flow sensor, Mega 2560, LCD and Keypad

What I want the code to do is:
When I start arduino, display asks for price input for 1 litre and store it in a variable for later use in calculations.

Then when water starts to flow, the display outputs flowing litres and equivalent price until stoped, just like in Gas stations.
Thank you in advance

With help from freqount library could be so useful to me or otherwise.

I use the Jaycar Freetronics flow meter. All you need is to add a numeric keypad to that.

I have added keypad, when I run the code the display keeps popping up messages randomly

#include <FreqCount.h>
#include <LiquidCrystal.h>
#include <Keypad.h>

const byte ROWS = 4;
const byte COLS = 4;

char keys[ROWS][COLS] = {
  {'7','8','9','K'},
  {'4','5','6','C'},
  {'1','2','3','X'},
  {'R','0','.','S'}
};

byte rowPins[ROWS] = {23, 25, 27, 29};
byte colPins[COLS] = {31, 33, 35, 37 };

Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );

LiquidCrystal lcd(8, 9, 10, 11, 12, 13);
int valvePin = 38;
int pumpPin = 22;
int v = 0; //set price
unsigned long p = 0; //counting pulses
float x = 0;  //litres per pulse p
float y = 0; //price per pulse p


void setup() {
  Serial.begin(57600);
  FreqCount.begin(1000);
  lcd.begin(20, 4);
  
}

int setPrice(){
  //(II) 
  lcd.println("SETI BEI IN TSHS");
  lcd.setCursor(0, 1);
  lcd.println("BONYEZA ( O K ) ");
  lcd.setCursor(0, 2);
  lcd.println("UKIMALIZA");
  lcd.setCursor(0, 3);
  lcd.println("LITA 1 = ");
  lcd.setCursor(9, 3);
  
   int price = 0;
   char key = keypad.getKey();
   switch (key)
   {
     case NO_KEY:
      break;

    case '0': case '1': case '2': case '3': case '4':
    case '5': case '6': case '7': case '8': case '9':
      lcd.setCursor(9, 3);
      lcd.print(key);
      price = price * 10 + (key - '0');
      break;

    case 'K':
        lcd.clear();
        return price;
        break;
        
    case 'X':
        break;
        
    case 'S':
        lcd.clear();
        setPrice();
        break;
        
    case '.':
        break;
        
    case 'R':
        lcd.clear();
        setup();
        break;
        
    case 'C':
        price = 0;
        lcd.setCursor(9, 3);
        lcd.write("      ");
        lcd.setCursor(9, 3);
   }


}

void loop() {
   v = setPrice();
   if (FreqCount.available()) {
     lcd.clear();
     p = FreqCount.read();
     x = p;
     y = x * v;
     //LITA
     lcd.setCursor(6,0);
     lcd.print("INAPIMA");
     lcd.setCursor(0,1);
     lcd.print("LITA = ");
     lcd.setCursor(7, 1);
     lcd.println(x);
     
     //BEI
     lcd.setCursor(0,2);
     lcd.print("BEI = ");
     lcd.setCursor(6, 2);
     lcd.println(y);
     
     delay(300);
  }
 
}

setPrice() seems to be calling itself, which is a bad idea if you don't know what you are doing, which you obviously don't.

It's hard to see how your overall process will work. What is turning the flow of liquid on or off ? I would suggest drawing a detailed flowchart of the events, the order they occur, and how the arduino is going to know when the whole process, and each step of the process, begins and ends.

I have already referred you to a flow meter, I'm afraid I have never heard of freqCount, but I think you are on the wrong tram.

I don't see any code there which is accumulating the total amount of liquid measured.

Also, loop( ) runs repeatedly, very fast. You will measure the flow once, and then go and ask for the price to be entered on the keypad again. That is not going to work.