Skip to main content

Programming using Java Hands On - Control Structures | Bill Generation

Bill Generation

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.


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!!!

Bill Generation   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.    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!!!


 

Result Description

Summary of tests
*Note: All the test cases might not have same weightage
+------------------------------+
|  6 tests run/ 6 tests passed |
+------------------------------+
 

Comments

Must Read:

Count Encodings

 1. You are given a string str of digits. (will never start with a 0) 2. You are required to encode the str as per following rules     1 -> a     2 -> b     3 -> c     ..     25 -> y     26 -> z 3. You are required to calculate and print the count of encodings for the string str.      For 123 -> there are 3 encodings. abc, aw, lc      For 993 -> there is 1 encoding. iic       For 013 -> This is an invalid input. A string starting with 0 will not be passed.      For 103 -> there is 1 encoding. jc      For 303 -> there are 0 encodings. But such a string maybe passed. In this case       print 0. Input Format A string str Output Format count of encodings Constraints 0 < str.length <= 10 Sample Input 123 Sample Output 3 Solution: import java.io.*; import java.util.*; public class Main {   ...

Zero One Knapsack | Recursion

 1. You are given a number n, representing the count of items. 2. You are given n numbers, representing the values of n items. 3. You are given n numbers, representing the weights of n items. 3. You are given a number "cap", which is the capacity of a bag you've. 4. You are required to calculate and print the maximum value that can be created in the bag without       overflowing it's capacity. Note: Each item can be taken 0 or 1 number of times. You are not allowed to put the same item again and again. Input Format A number n v1 v2 .. n number of elements w1 w2 .. n number of elements A number cap Output Format A number representing the maximum value that can be created in the bag without overflowing it's capacity Constraints 1 <= n <= 20 0 <= v1, v2, .. n elements <= 50 0 < w1, w2, .. n elements <= 10 0 < cap <= 10 Sample Input 5 15 14 10 45 30 2 5 1 3 4 7 Sample Output 75 Solution: import java.io.*; import java.util.*; public class Main...

Floyd's Triangle

/*  To Print Floyd's Triangle 1    2   3    4   5   6    7   8   9   10   11  12  13  14  15   */ #include   <iostream> using   namespace   std ; int   main (){       #ifndef  ONLINE_JUDGE          freopen ( "../asset/input.txt" , "r" , stdin );          freopen ( "../asset/output.txt" , "w" , stdout );     #endif     // Code here!!      int   n ;  cin >> n ;      int   count  =  1 ;      for ( int   i = 0 ; i < n ; i ++){          for ( int   j = 0 ; ...

UNIX Introduction to Unix

  Calendar1 Display the previous, current and next month calendar of the  year 1987 august Calendar2 Display and see what is the specialty of September 1752. Calendar 5 Write a command to display the previous, current and next month calendar of the year 2015 December.

Data Formats ( XML & JSON ) XML AND JSON | Generate XSD for Persons

  Generate XSD for Persons Generate XSD for the following XML. XYZ organization wants to store the details of persons in an xml file. The following scenario helps in designing the XML document. Here PersonList  is the root tag. PersonList contains the entry of each person with adhaarno, name, age and address. <?xml version="1.0"  encoding="UTF-8"?> <PersonList xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="PersonList.xsd">     <Person>         <adhaarno>414356782345</adhaarno>         <name>             <firstname>Zeenath</firstname>         </name>         <age>28</age>         <address>             <doorno...

DH ASE B3 Slot 3 Mock 1 - Quiz

 DH ASE B3       Slot 3            Mock 1                 Quiz

Basics of Java | Operators | Day 1

Problem: Operators are symbols that perform operations on variables and values. For example, + is an operator used for addition , while * is also an operator used for multiplication . Operators in Java can be classified into 6 types: Arithmetic Operators Assignment Operators Relational Operators Logical Operators Unary Operators Bitwise Operators References: Click Here . We will discuss about arithmetic operators and rest you can study from the references mentioned above. Arithmetic Operators: Arithmetic operators are used to perform arithmetic operations on variables and data. For example, a + b; Here, the + operator is used to add two variables a and b. Similarly, there are various other arithmetic operators in Java. Operator Operation + Addition - Subtraction * Multiplication / Division % Modulo Operation (Remainder after division) Task: You are given two integers as input a and b You need to perform several...

0-1 Pattern

  /* @ToDo  0-1 Pattern     1     0   1     0   1   0     1   0   1   0     1   0   1   0   1 */ #include   <iostream> using   namespace   std ; int   main (){       #ifndef  ONLINE_JUDGE          freopen ( "../asset/input.txt" , "r" , stdin );          freopen ( "../asset/output.txt" , "w" , stdout );     #endif     // Code here!!      int   n ;  cin >> n ;      int   sign  =  1 ;      for ( int   i = 1 ; i <= n ; i ++){    ...

Data Formats ( XML & JSON ) XML AND JSON | Generate XSD 4

  Generate XSD 4 Generate an XSD for the following XML document <?xml version="1.0" encoding="UTF-8"?> <company> <employee> <id>101</id> <name>Ram</name> <salary>10000</salary> <email>ram@gmail.com</email> </employee> <employee> <id>102</id> <name>Dinesh</name> <salary>20000</salary> <email>dinesh@gmail.com</email> </employee> <employee> <id>103</id> <name>sathish</name> <salary>20000</salary> <email>sathish@gmail.com</email> </employee> <employee> <id>104</id> <name>Praveen</name> <salary>20000</salary> <email>praveen@gmail.com</email> </employee> </company> <? xml  version = "1.0"  encoding = "UTF-8" ?> < xs:schema   xmlns:xs = "http://www.w3.org/2001/XMLSchema"   elementF...

Subscribe to Get's Answer by Email