Answer to Question #257089 in C++ for jimsy

Question #257089

Using a Decision Control Structure (if), create a flowchart and a java program that

reads a commodity code, quantity of the commodities bought and the unit price and

output the amount to be paid by the customer.


1
Expert's answer
2021-10-27T00:26:36-0400
import java.util.Scanner;
public class Main
{
	public static void main(String[] args) {
	    Scanner in=new Scanner(System.in);
	    int commodity_code;
	    int quantity;
	    double unit_price;
	    System.out.println("Enter commodity code: ");
	    commodity_code=in.nextInt();
	    System.out.println("Enter quantity of commodity: ");
	    quantity=in.nextInt();
	    System.out.println("Enter unit price: ");
	    unit_price=in.nextInt();
	    
	    double total_price=unit_price*quantity;
	    
	    System.out.println("Total price = "+total_price);
	}
}

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