Answer to Question #253082 in Java | JSP | JSF for ajj

Question #253082

create a simple program that will calculate the total amount due, accept payment, and display the change


1
Expert's answer
2021-10-18T18:26:33-0400
import java.util.Scanner;
public class Main
{
	public static void main(String[] args) {
	    Scanner input=new Scanner(System.in);
		System.out.println("Enter the price: ");
		int A=input.nextInt();
	    int Amount=A*2;
		System.out.println("Enter the payment: ");
		int X=input.nextInt();
		int change=X-Amount;
		if(X>A){
		    System.out.println("The change is: "+change);
	}
	else{
	    System.out.println("Payment is less");
	}
}
}

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