Answer to Question #277839 in Java | JSP | JSF for ansjskkxkxjajsjdkx

Question #277839

The taxi has a base fee of P40.00 for the first 250 meters. An additional P2.50 is added for every succeeding 200 meters. Compute and print the total fare that you would need to pay


1
Expert's answer
2021-12-09T17:34:17-0500


import java.util.Scanner;


public class App {


	/**
	 * The start point of the program
	 * 
	 * @param args
	 * 
	 */
	public static void main(String[] args) {
		Scanner keyBoard = new Scanner(System.in);
		System.out.print("Enter meters: ");
		int meters = keyBoard.nextInt();
		float totalFare = 0;
		if (meters <= 250) {
			totalFare = (float) (40.0);
		}else {
			totalFare = (float) ((float) (40.0)+(((meters-250)/200)*2.50));
		}
		System.out.println("\nThe total fare that you would need to pay: P"+totalFare);


		keyBoard.close();
	}
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS