I got this question to complete in college recently. I am new to Java so slowly learning, there could be some mistakes

This is what I have done so farQuote:

Calculations and if – else (the sponsored cyclist). A cyclist is sponsored at the rate of 7c for each km up to 10 km, and 10c for each km in excess of 10km. Write a program which will ask for the cyclist’s first name, initial and last name and the distance cycled. Your program should calculate the money due, then display a dialog containing the cylist’s full name (first name + initial + last name), the distance cycled, and the money due. Note here that the problem involves 2 different rates if the number of km exceeds 10 so, for example, if the cyclist is sponsored for 15km then the first 10km are sponsored at 7c and the remaining 5 km are sponsored at 10c giving a total of 70c + 50c i.e. €1.20. Your solution should work correctly no matter what the distance is.

I'm having a problem with this partCode:`import javax.swing.JOptionPane;`

public class Cyclist{

public static void main (String args []){

String firstName,lastName,initialAsString;

char initial;

int distanceTravelled;

firstName = JOptionPane.showInputDialog ("Please enter your name");

initialAsString = JOptionPane.showInputDialog ("Please enter your initial");

initial = initialAsString.charAt(0);

lastName = JOptionPane.showInputDialog ("Please enter your last name");

distanceTravelled = Integer.parseInt (JOptionPane.showInputDialog ("Please enter the distance travelled"));

if (distanceTravelled < 10){

JOptionPane.showMessageDialog(null, "Your name is: "+firstName+ " ."+initial +

" "+lastName+"\nDistance Travelled: "+distanceTravelled+"km\nThe amount " +

" of money due is " +distanceTravelled*7);

}else{

if (distanceTravelled > 10){

JOptionPane.showMessageDialog(null, "Your name is: "+firstName+ " ."+initial +

" "+lastName+"\nDistance Travelled: "+distanceTravelled+"km\nThe amount " +

" of money due is " +distanceTravelled*10);

}

}

}

}

I would appreciate some help. ThanksQuote:

if the cyclist is sponsored for 15km then the first 10km are sponsored at 7c and the remaining 5 km are sponsored at 10c giving a total of 70c + 50c i.e. €1.20. Your solution should work correctly no matter what the distance is.