Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a program named TotalPrice.java. Your program takes two number from the Cm

ID: 3742085 • Letter: W

Question

 Write a program named TotalPrice.java. Your program takes two number from the Cmd argument list, N  and P, N is the number of product and P is the unit price of the product. Your program will calculate and display total cost. For example, if you input 4 5 then your program output:  Total Cost=20
   
  Write a program named TotalPrice.java. Your program takes two number from the Cmd argument list, N  and P, N is the number of product and P is the unit price of the product. Your program will calculate and display total cost.  For example, if you input 4 5 then your program output:    Total Cost=20
     

Explanation / Answer

public class TotalPrice { public static void main(String[] args) { if(args.length >= 2) { int N = Integer.parseInt(args[0]); int P = Integer.parseInt(args[1]); System.out.println("Total Cost=" + (N*P)); } } }

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote