my charging circuit code problems from a new arduino user

Hi I am a new Arduino user and have no code writing experience but I have made a few little projects and written some very simple code. Now I want to try and expand one of my projects but have hit a brick wall. This is what I have at the moment including the code I am using and underneath the code is what I want to achieve.
Please help if you can.

My home made supercapacitor charger
I have some super capacitors which I am experimenting with. They are all 2.7 volts and I have them connected to different circuits. Some of the circuits run off 2.7 volts and some at 5.4 volts and so on.
I have built a charging circuit using a relay which is controlled via my arduino uno through a transistor and resistor connected to one pin on the arduino and have some leds to indicate the state of charge on the capacitors which are connected also to my arduino. When a certain voltage is reached the reading on the sense pin is reached the relay cuts off. But I have 4 different sketches to charge to different voltages. I know I can change the values on the analogRead lines of one sketch to change what the charger charges my supercapacitors to but this is a lot of messing around.
This is the code I am using at the moment

int sensePin =0;
int relayPin = 9;
int lowledPin = 12;
int okledPin = 11;
int fullchargePin = 13;
void setup(){
analogReference (DEFAULT);
pinMode (relayPin, OUTPUT);
pinMode (lowledPin, OUTPUT);
pinMode (okledPin, OUTPUT);
pinMode (fullchargePin, OUTPUT);

void loop() {
int val = analogRead(sensePin);
if(val <300) digitalWrite(relayPin, HIGH);
if (val <99) digitalWrite (lowledPin, LOW);
if(val >100) digitalWrite (lowledPin, HIGH);
if (val >450) digitalWrite(okledPin, HIGH);
if (val <329) digitalWrite(okledPin, LOW);
) digitalWrite(relayPin, LOW);
if(val <490) digitalWrite(fullchargePin, LOW);

else digitalWrite(fullchargePin, HIGH);


I will gladly do without the led status that I have on my circuit to get something like this
The idea
This is what I would really like to do but I have no idea what code to write
4 push buttons connected to one pin with a 2k resistor between each one so that when button one is pressed there is 2k resistance. When button 2 is pressed there is 4 k resistance and so on. Obviously read by a sensepin. I know how to wire this part up but not the code needed.
I would have an led in front of each button to show which button was pressed.

Right if button 1 is pressed my charger will charge to 2.7 volts. If button 2 is pressed it will charge to 5.4 volts and so on.
When one of the buttons is pressed one of 4 leds will light and the relay will latch letting current flow. When a predetermined voltage is reached on the supercapacitor the corresponding value is read by the arduino sense pin. The relay unlatches, the led goes out and an led (it can be this led or a separate one will then blink until any button is pressed) leaving the circuit in the waiting state ready for the next button press.

I just cannot work out how to achieve this so I am asking for any help please.
Thank you for taking the time to read all this. I am starting to think that I will never get this to work