import java.util.*;
public class distance
{
public static void main(String[]args)
{
System.out.println("A GRAB Taxi charges P50.00 minimum fare for the first 300 meters and 5.00pesos for every succeeding 100 meters.");
double mf=50;
double distance;
double pay;
double change;
Scanner one= new Scanner(System.in);
System.out.print("Distance(m):");
distance = one.nextDouble();
if (distance<=300)
{
System.out.println("Total Fare :" +mf);
System.out.print("Payment :");
pay=one.nextDouble();
if(pay >= mf)
{
double Change=(pay-mf);
System.out.println("Your Changes :" +Change);
System.out.println("Thank you i hope you enjoy the ride!");
}
else if (pay< mf)
{
System.out.println("**YOUR PAYMENT IS NOT ENOUGH PLSSS PAY AGAIN BEFORE YOU LEAVE**");
System.out.print("Payment :");
pay=one.nextDouble();
double Change=(pay-mf);
System.out.println("Your Changes :" +Change);
System.out.println("Thank you i hope you enjoy the ride!");
}
}
else if (distance>300)
{
double A=distance-300;
double B=A/100;
double C=B*5;
double D=C+50;
Scanner Two= new Scanner(System.in);
System.out.println("Total fare:" +D);
Scanner two= new Scanner(System.in);
System.out.print("Payment :");
pay=two.nextDouble();
if(pay >= mf)
{
double Change=(pay-mf);
System.out.println("Your Changes :" +Change);
System.out.println("Thank you i hope you enjoy the ride!");
}
else if (pay< mf)
{
System.out.println("**YOUR PAYMENT IS NOT ENOUGH PLSSS PAY AGAIN BEFORE YOU LEAVE**");
System.out.print("Payment :");
pay=two.nextDouble();
double Change=(pay-mf);
System.out.println("Your Changes :" +Change);
System.out.println("Thank you i hope you enjoy the ride!");
}
}
}
}
public class distance
{
public static void main(String[]args)
{
System.out.println("A GRAB Taxi charges P50.00 minimum fare for the first 300 meters and 5.00pesos for every succeeding 100 meters.");
double mf=50;
double distance;
double pay;
double change;
Scanner one= new Scanner(System.in);
System.out.print("Distance(m):");
distance = one.nextDouble();
if (distance<=300)
{
System.out.println("Total Fare :" +mf);
System.out.print("Payment :");
pay=one.nextDouble();
if(pay >= mf)
{
double Change=(pay-mf);
System.out.println("Your Changes :" +Change);
System.out.println("Thank you i hope you enjoy the ride!");
}
else if (pay< mf)
{
System.out.println("**YOUR PAYMENT IS NOT ENOUGH PLSSS PAY AGAIN BEFORE YOU LEAVE**");
System.out.print("Payment :");
pay=one.nextDouble();
double Change=(pay-mf);
System.out.println("Your Changes :" +Change);
System.out.println("Thank you i hope you enjoy the ride!");
}
}
else if (distance>300)
{
double A=distance-300;
double B=A/100;
double C=B*5;
double D=C+50;
Scanner Two= new Scanner(System.in);
System.out.println("Total fare:" +D);
Scanner two= new Scanner(System.in);
System.out.print("Payment :");
pay=two.nextDouble();
if(pay >= mf)
{
double Change=(pay-mf);
System.out.println("Your Changes :" +Change);
System.out.println("Thank you i hope you enjoy the ride!");
}
else if (pay< mf)
{
System.out.println("**YOUR PAYMENT IS NOT ENOUGH PLSSS PAY AGAIN BEFORE YOU LEAVE**");
System.out.print("Payment :");
pay=two.nextDouble();
double Change=(pay-mf);
System.out.println("Your Changes :" +Change);
System.out.println("Thank you i hope you enjoy the ride!");
}
}
}
}
Attachments
-
You do not have permission to view the full content of this post. Log in or register now.