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, By using the class 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 dollar

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
icon
Concept explainers
Question

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, By using the class 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

 

Expert Solution
steps

Step by step

Solved in 4 steps with 6 images

Blurred answer
Knowledge Booster
Operators
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education