2. Write a program that inputs the name, quantity, and price of three items. The name may contain spaces. Output a bill with a tax rate of 6.25%. All prices should be output to two decimal places. The bill should be formatted in columns with 30 characters for the name, 10 characters for the quantity, 10 characters for the price, and 10 characters for the total. Sample input and output are shown as follows: Input name of item 1: lollipops Input quantity of item 1: 10 Input price of item 1: 0.50 Input name of item 2:1 diet soda Input quantity of item 2: 3 Input price of item 2: 1.25 Input name of item 3:1 chocolate bar Input quantity of item 3: 20 Input price of item 3: 0.75 Your bill: Item lollipops diet soda chocolate bar Subtotal 6.25% sales tax Total Quantity 10 3 20 Price 0.50 1.25 0.75 Total 5.00 3.75 15.00 23.75 1.48 25.23
Operations
In mathematics and computer science, an operation is an event that is carried out to satisfy a given task. Basic operations of a computer system are input, processing, output, storage, and control.
Basic Operators
An operator is a symbol that indicates an operation to be performed. We are familiar with operators in mathematics; operators used in computer programming are—in many ways—similar to mathematical operators.
Division Operator
We all learnt about division—and the division operator—in school. You probably know of both these symbols as representing division:
Modulus Operator
Modulus can be represented either as (mod or modulo) in computing operation. Modulus comes under arithmetic operations. Any number or variable which produces absolute value is modulus functionality. Magnitude of any function is totally changed by modulo operator as it changes even negative value to positive.
Operators
In the realm of programming, operators refer to the symbols that perform some function. They are tasked with instructing the compiler on the type of action that needs to be performed on the values passed as operands. Operators can be used in mathematical formulas and equations. In programming languages like Python, C, and Java, a variety of operators are defined.
Introduction
Sales Tax: The buying and selling of items inside the nation are subject to sales tax, an indirect tax. In essence, sales tax is a fee that is added on top of the basic price of the item being purchased. The government levies this tax on the seller, who can then recover it from the buyer. This tax is assessed when a customer makes their final purchase of a product or when certain commodities are exchanged. On the value of the item, a variable proportion of sales tax is applied.
Step by step
Solved in 4 steps with 3 images