Answer to Question #298940 in Java | JSP | JSF for rim

Question #298940

Write an application that accepts the unit weight of a bag of coffee in pounds and

the number of bags sold and displays the total price of the sale, computed as

total price = unitweight * number of units * INR 25;

total price with tax = total price + totalprice * INR 0.70,

where 25 is the cost per 200grams and 0.70 is the sales tax. Use data type of

float.


1
Expert's answer
2022-02-20T01:47:09-0500


import java.util.*;


class App {


	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);


		System.out.print("Enter the unit weight of a bag of coffee in pounds: ");
		float unitweight = in.nextFloat();
		System.out.print("Enter the number of units: ");
		float numberUnits = in.nextFloat();
		float totalprice = unitweight * numberUnits * 25;
		float totalpricetax = (float) (totalprice + totalprice * 0.70);
		System.out.printf("\nThe total price: %.2f\n", totalprice);
		System.out.printf("The total price tax: %.2f\n", totalpricetax);


		in.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