In your favorite open world adventure video game, currency conversion is as given below:     1 Gold coin 23 Bolts 1 Gem 13 Gold coins Write a program that takes a number of Bolts as user input (as an integer) and converts it to the number of whole Gems, Gold coins, and Bolts as shown below. The conversion information between these measurement metrics is provided in the table above. The number of Bolts should be converted in such a way that maximizes the whole number of Gems and Gold coins. Expected output 1 (bold is user input) Enter the number of Bolts: 32 0 Gems(s) 1 Gold coin(s) 9 Bolt(s) Expected output 2 (bold is user input) Enter the number of Bolts: 3000 10 Gem(s) 0 Gold coin(s) 10 Bolt(s) The file should be named as convertCurrency.cpp. Don’t forget to head over to Coderunner on Canvas and paste your solution in the answer box!

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
Question

In your favorite open world adventure video game, currency conversion is as given below:

   
1 Gold coin 23 Bolts
1 Gem 13 Gold coins

Write a program that takes a number of Bolts as user input (as an integer) and converts it to the number of whole Gems, Gold coins, and Bolts as shown below. The conversion information between these measurement metrics is provided in the table above. The number of Bolts should be converted in such a way that maximizes the whole number of Gems and Gold coins.

Expected output 1 (bold is user input)

Enter the number of Bolts: 32 0 Gems(s) 1 Gold coin(s) 9 Bolt(s)

Expected output 2 (bold is user input)

Enter the number of Bolts: 3000 10 Gem(s) 0 Gold coin(s) 10 Bolt(s)

The file should be named as convertCurrency.cpp. Don’t forget to head over to Coderunner on Canvas and paste your solution in the answer box!

 

In your favorite open world adventure video game, currency conversion is as given below:
1 Gold coin
1 Gem
23 Bolts
13 Gold coins
Write a program that takes a number of Bolts as user input (as an integer) and converts it to the number of whole Gems, Gold coins, and
Bolts as shown below. The conversion information between these measurement metrics is provided in the table above. The number of Bolts
should be converted in such a way that maximizes the whole number of Gems and Gold coins.
Expected output 1 (bold is user input)
Enter the number of Bolts:
32
0 Gems (s) 1 Gold coin(s) 9 Bolt(s)
Expected output 2 (bold is user input)
Enter the number of Bolts:
3000
10 Gem (s) 0 Gold coin(s) 10 Bolt(s)
The file should be named as convertCurrency.cpp. Don't forget to head over to Coderunner on Canvas and paste your solution in the
answer box!
Transcribed Image Text:In your favorite open world adventure video game, currency conversion is as given below: 1 Gold coin 1 Gem 23 Bolts 13 Gold coins Write a program that takes a number of Bolts as user input (as an integer) and converts it to the number of whole Gems, Gold coins, and Bolts as shown below. The conversion information between these measurement metrics is provided in the table above. The number of Bolts should be converted in such a way that maximizes the whole number of Gems and Gold coins. Expected output 1 (bold is user input) Enter the number of Bolts: 32 0 Gems (s) 1 Gold coin(s) 9 Bolt(s) Expected output 2 (bold is user input) Enter the number of Bolts: 3000 10 Gem (s) 0 Gold coin(s) 10 Bolt(s) The file should be named as convertCurrency.cpp. Don't forget to head over to Coderunner on Canvas and paste your solution in the answer box!
Expert Solution
Step 1

Answer:

Code in C++:

#include <iostream>
using namespace std;
int main()
{
    int bolt,gem=0,gold=0; //declare veriable 
    cout<<"Enter the number of Bolts:\n";
    cin>>bolt;  //take input from user 
    gold=bolt/23;   //find number of gold coin 
    bolt=bolt%23;   //calculate rest bolts 
    gem=gold/13;    //convert gold to gem 
    gold=gold%13;   //calculate rest gold coins 
    cout<<gem<<" Gem(s) "<<gold<<" Gold coin(s) "<<bolt<<" Bolt(s)";    //print output 
    return 0;
}
steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Random Class and its operations
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