Java program to calculate uber cost and discount rate

Java program to calculate uber cost and discount rate. Uber is one of the most popular taxi services in town. Uber’s owner intends to offer a significant discount to its clients. The discount is calculated according to the distance travelled. Create a Java software to determine the total fare for the consumer, taking into account any applicable discounts.

import java.util.Scanner;
public class Main
{
public static void main(String[] args) {
double money =0;
Scanner sc = new Scanner(System.in);
System.out.println("Enter the name");
String name = sc.nextLine();
System.out.println("Enter distance travelled by the customer");
int dist = sc.nextInt();

if(dist<200 || dist>5000){
System.out.println(dist+" is out of range");
return;
}
else if(dist>= 200 && dist<=500){
money = dist*12;
money = money * 0.97;
}
else if(dist>= 501 && dist <=1000){
money = dist*10;
money = money * 0.95;
}
else if(dist>= 1001 && dist <= 2999){
money = dist*10;
money = money * 0.90;
}
else if(dist>= 3000 && dist <=5000){
money = dist*8;
money = money * 0.85;
}
System.out.println("Total money after discount is "+money);

}
}

Enter the name
raghu
Enter distance travelled by the customer
350
Total money after discount is 4074.0