Write a program in bluej to accept the rates and quantity of 3 items (Oats, Rice,Pulses) and calculate total bill
please help me i need it today only
Answers
Answer:
Input from user
rate for oats a = 10;
rate for rice b = 20;
rate for pulses c = 30;
quantity for oats x=a*2;
quantity for rice y=a*3;
quantity for pulse z=a*1;
total bill=a+b+c;
Explanation:
import java.util.Scanner;
public class Bill
{
public static void main(String args[])
{
int ra,rb,rc,qa,qb,qc;
Scanner obj=new Scanner(System.in);
System.out.println("Enter the rate of rice");
ra=obj.nextInt();
System.out.println("Enter the quantity of rice");
qa=obj.nextInt();
int rice=ra*qa;
System.out.println("Enter the rate of Oats");
rb=obj.nextInt();
System.out.println("Enter the quantity of Oats");
qb=obj.nextInt();
int oats=rb*qb;
System.out.println("Enter the rate of Pulses");
rc=obj.nextInt();
System.out.println("Enter the quantity of Pulses");
qc=obj.nextInt();
int pulses=rc*qc;
int totalbill=rice+oats+pulses;
System.out.println("totalbill is="+totalbill);
}
}