Computer Science, asked by nikita123466, 11 months ago

write a program in java in which computer will display total bill where a bread cost rupees 23.5 and an egg cost rupees 5.75 where the user will have to enter the number of bread and eggs purchased ​

Answers

Answered by FlyingSaturn
2

Answer:

/*

Write a program in java in which computer will display total bill where a bread cost rupees 23.5 and an egg cost rupees 5.75, where the user will have to enter the number of bread and eggs purchased .

*/

import java.util.*;

class BE

{

public static void main(String args[])

{// we are using Scanner class

double bread,eggs,totalb,totalc, total = 0.0;

Scanner b = new Scanner(System.in);

System.out.println("Enter the no. of bread purchased");

bread = b.nextDouble();

System.out.println("Enter the no. of eggs purchased");

eggs = b.nextDouble();

totalb = 23.5 * bread;

totale = 5.75 * eggs;

total = totalb + totalc;

System.out.println("The total cost is = Rs." + total);

}

}

Similar questions