PLEASE TELL ME WHAT DO YOU THINK GUYS.
becuase if the distance is less then 100 kilometers.
but i have figure out how i can make it.
//This program calculate the distance (using pytagoras formula),
// calculating the price per 100 kilometers. using user input.
// checking if the credit card is valid(user input)
import java.util.Scanner;
public class TravelAgency
{
public static void main(
String[]Args)
{
Scanner scan = new Scanner(System.in);
System.out.println("Hello, Please enter your" +" "+
"destination in two integers:");
//variables and variables for calculation.
final int pricePer = 50;
final int distanceInKm = 100;
int userPoint1, userPoint2, cerditCard,
destination ,flightPrice,x,y, a, b;
//getting userinput for the formula.
userPoint1 = scan.nextInt();
userPoint2 = scan.nextInt();
//calculating the userinput with the formula.
destination = (int)Math.sqrt((userPoint1*userPoint1)+
(userPoint2*userPoint2));
//calculation the price + if the kilometer is less then 100 or 0.
flightPrice = ((destination/distanceInKm)*pricePer);
a= destination%distanceInKm;
if (a!=0)
{
System.out.println("The price of the flight is:"+" "+
(flightPrice+pricePer));
}
if (userPoint2==0&&(userPoint1==0)){
System.out.println("The price of the flight is 0"+ " "+
"but we still will check your credit card");}
//getting credit card number from user.
System.out.println("Please enter your credit card number:");
cerditCard = scan.nextInt();
//checking if the credit card is valid.
//1-6 numbers+ first number not 0
// and checking if first5Numbers%7 == last number.
x = cerditCard/10;
y = cerditCard%10;
b = y%7;
if (cerditCard<999999&&cerditCard>99999&&(b==y))
{
System.out.println("bon voyage");
}
else
{System.out.println("Your credit card is invalid");}
}
}// end of program.