Michele is an American tourist. He is now in Jordan to visit Petra and he wants to go shopping, he has an amount of money from both currencies: Jordanian Dinar (JOD) and United States (US) dollar. For a given item with a specified price (p) in JOD, write a C++ program to help Mr. Michele to determine if he can buy the item or not. If the answer is "YES", then determine how many: US dollars he needs to pay if he hasn't enough JODs to buy the item, the remaining number of JODs, and the remaining number US dollars. Assume the following: One JOD = 1.41 US dollar One US dollar = 0.71 JOD Input Format Three space-separated real values: US, JOD, and P, where : US: the number of US dollars held by Michele JOD: the number of Jordanian dinars held by Michele P: the item price in Jordanian Dinar Output Format See the sample outputs for the required messages. Sample #1 Input 10 5 30 Output Sorry , you haven't enough money to buy this item Sample #2 Input 100 20 20 Output You have the exactly number of JODs to buy this item After buying this item you will have 0 JODs and 100 dollars Sample #3 Input 200 50 30 Output You have enough JODs to buy this item After buying this item you will have 20 JODs and 200 dollars Sample #4 Input 150 50 65 Output You haven't enough JODs to buy this item You need 21.15 dollars to buy this item After buying this item you will have 0 JODs and 128.85 dollars
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.
Michele is an American tourist. He is now in Jordan to visit Petra and he wants to go shopping, he has an amount of money from both currencies: Jordanian Dinar (JOD) and United States (US) dollar.
For a given item with a specified price (p) in JOD, write a C++ program to help Mr. Michele to determine if he can buy the item or not. If the answer is "YES", then determine how many: US dollars he needs to pay if he hasn't enough JODs to buy the item, the remaining number of JODs, and the remaining number US dollars.
Assume the following:
One JOD = 1.41 US dollar
One US dollar = 0.71 JOD
Input Format
Three space-separated real values: US, JOD, and P, where :
US: the number of US dollars held by Michele
JOD: the number of Jordanian dinars held by Michele
P: the item price in Jordanian Dinar
Output Format
See the sample outputs for the required messages.
Sample #1
Input
10 5 30
Output
Sorry , you haven't enough money to buy this item
Sample #2
Input
100 20 20
Output
You have the exactly number of JODs to buy this item
After buying this item you will have 0 JODs and 100 dollars
Sample #3
Input
200 50 30
Output
You have enough JODs to buy this item
After buying this item you will have 20 JODs and 200 dollars
Sample #4
Input
150 50 65
Output
You haven't enough JODs to buy this item
You need 21.15 dollars to buy this item
After buying this item you will have 0 JODs and 128.85 dollars
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 4 images