i will mark brainlist who ever gives me correct answer and please use Scanner class
Attachments:
Answers
Answered by
1
Answer:
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner read=new Scanner(System.in);
System.out.print("Enter the product id: ");
String productid=read.nextLine();
System.out.print("Enter the price: ");
Float price=read.nextFloat();
System.out.print("Enter the quantity: ");
Integer quantity=read.nextInt();
Float totalcost=price*quantity;
String out1=String.format("The product id is %s",productid);
String out2=String.format("The total cost is %.2f",totalcost);
System.out.println(out1);
System.out.println(out2);
Float paycost=(totalcost*88)/100;
String out3=String.format("The net amout to be paid is %.2f",paycost);
System.out.println(out3);
}
}
Similar questions