World Languages, asked by dina91580, 10 months ago

Tom went to a movie with his friends in a multiplex theatre and during break time he bought pizzas, puffs and cool drinks. Consider the following prices :

Rs.100/pizza
Rs.20/puffs
Rs.10/cooldrink
Generate a bill for What Tom has bought .
generate a code in java.

Answers

Answered by tppk1998
14

Answer:

import java.util.Scanner;

public class Main

{

public static void main(String[] args) {

    float totalprice;

    Scanner sc = new Scanner(System.in);

 System.out.print("Enter no.of puffs :" +" ");

 int i = sc.nextInt();

 System.out.print("Enter no. of puffs :" +" ");

 int j = sc.nextInt();

 System.out.print("Enter no.of cooldrinks :" +" ");

 int k = sc.nextInt();

 i =Math.abs(i)*100;

 j =Math.abs(j)*20;

 k =Math.abs(k)*10;

 System.out.println("Bill Details");

 System.out.println("Price of above No. of Pizzas =" +i);

 System.out.println("Prize of above No. of puffs =" +j);

 System.out.println("Prize of above No. of Cooldrinks =" +k);

 totalprice = i+j+k;

 System.out.println("Total Price =" +totalprice);

 System.out.println("   "+"Enjoy the Show!!!"+"   ");

}

}

Explanation:

it is the simple java program we can practice.Bill generation for java is like C programming and here,  the Math class inclusion can improve the robustness of the program

Answered by ravilaccs
0

Answer:

The java code is implemented given below

Explanation:

Program

import java.util.Scanner;

public class SnacksDetails

{

   public static void main (String[] args) {

       Scanner sc=new Scanner(System.in);

       System.out.println("Enter the no of pizzas bought:");

       int pizz=sc.nextInt();

       System.out.println("Enter the no of puffs bought:");

       int puff=sc.nextInt();

       System.out.println("Enter the no of cool drinks bought:");

       int cdrnk=sc.nextInt();        

       System.out.println("Bill Details");

       System.out.println("No of pizzas:"+pizz);

       System.out.println("No of puffs:"+puff);

       System.out.println("No of cooldrinks:"+cdrnk);

       System.out.println("Total price="+(pizz*100+puff*20+cdrnk*10));

       System.out.println("ENJOY THE SHOW!!!");

   }

}

Sample Input 1:

Enter the no of pizzas bought:10

Enter the no of puffs bought:12

Enter the no of cool drinks bought:5

Sample Output 1:

Bill Details

No of pizzas:10

No of puffs:12

No of cooldrinks:5

Total price=1290

ENJOY THE SHOW!!!

Similar questions