1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Korolek [52]
3 years ago
12

Write a program that helps a young student learn to make change. Use the random number generator to generate change amounts betw

een1¢ and 99¢. Ask the user how many quarters, dimes, nickels and pennies they need to make that amount. Determine whether the coins specified by the user total the specified amount and give them feedback on their answer including whether they used the minimum or optimum number of coins to produce the amount.
Computers and Technology
1 answer:
erastovalidia [21]3 years ago
6 0

Answer:

#include <iostream>

#include <stdlib.h>

using namespace std;

int main()

{

srand(time(0));

 

int coins = rand()%99 + 1;

int temp = coins;

cout<<"Enter the coins needed to make $0."<<coins<<"?"<<endl<<endl;

int a, b, c, d;

cout<<"Quarters? ";

cin>>a;

cout<<"Dimes? ";

cin>>b;

cout<<"Nickles? ";

cin>>c;

cout<<"Pennies? ";

cin>>d;

 

int quarters = coins/25;

 

coins = coins%25;

 

int dimes = coins/10;

 

coins = coins%10;

 

int nickles = coins/5;

coins = coins%5;

 

int pennies = coins/1;

 

if(((a*25) + (b*10) + (c*5) + (d*1))==temp)

{

cout<<"That's correct"<<endl;

 

if(a!=quarters || b!=dimes || c!=nickles || d!=pennies)

{

cout<<"The optimized solution is "<<endl;

}

}

else

{

cout<<"Not correct"<<endl;

cout<<"The solution is "<<endl;

 

}

 

cout<<"\tQuarters: "<<quarters<<endl;

cout<<"\tDimes: "<<dimes<<endl;

cout<<"\tNickles: "<<nickles<<endl;

cout<<"\tPennies: "<<pennies<<endl;

return 0;

}#include <iostream>

#include <stdlib.h>

using namespace std;

int main()

{

srand(time(0));

 

int coins = rand()%99 + 1;

int temp = coins;

cout<<"Enter the coins needed to make $0."<<coins<<"?"<<endl<<endl;

int a, b, c, d;

cout<<"Quarters? ";

cin>>a;

cout<<"Dimes? ";

cin>>b;

cout<<"Nickles? ";

cin>>c;

cout<<"Pennies? ";

cin>>d;

 

int quarters = coins/25;

 

coins = coins%25;

 

int dimes = coins/10;

 

coins = coins%10;

 

int nickles = coins/5;

coins = coins%5;

 

int pennies = coins/1;

 

if(((a*25) + (b*10) + (c*5) + (d*1))==temp)

{

cout<<"That's correct"<<endl;

 

if(a!=quarters || b!=dimes || c!=nickles || d!=pennies)

{

cout<<"The optimized solution is "<<endl;

}

}

else

{

cout<<"Not correct"<<endl;

cout<<"The solution is "<<endl;

 

}

 

cout<<"\tQuarters: "<<quarters<<endl;

cout<<"\tDimes: "<<dimes<<endl;

cout<<"\tNickles: "<<nickles<<endl;

cout<<"\tPennies: "<<pennies<<endl;

return 0;

}

Explanation:

  • Use the built-in rand function to generate a random coin.
  • Get all the required values for quarters, dimes, nickles and pennies and store them in variables.
  • Check if the coins give a value of temp, then answer is correct and the values of user will be added.
  • Optimum solution is displayed  If it does not matches with the optimum solution. Display that the answer is wrong along with solution.
You might be interested in
As computers become faster, memory access speeds are not keeping pace. Question 5 options: True False
oee [108]

Answer:

True

Explanation:

As computers become faster, memory access speed have not been keeping pace. In 1999, processor speeds went up from 90MHz to 500MHz, but during this same period, memory access have only gone from 120ns to 50ns. This shows that in this period, processor speed grew more than five times its value, but memory grew only 2.5 times its value.

8 0
4 years ago
After an entry in the medical record has been written or keyed and an error is discovered, what procedure should be followed to
Readme [11.4K]

Answer:

(C) Draw a line through the error; then call the patient’s physician.

Explanation:

According to my research on medical procedures, I can say that based on the information provided within the question the best procedure that should be taken in this situation would be to draw a line through the error; then call the patient’s physician. By doing so you get rid of the the error and by telling the patient's physician you get rid of any possibility of the physician still thinking that the error was something that was already done.

I hope this answered your question. If you have any more questions feel free to ask away at Brainly.

5 0
3 years ago
Select the correct answer.
Shtirlitz [24]

Answer:

The right answer is text. we just need to just mention the date inside the text, and also mention the cell number, where you want that to be printed. The formula is Text(B1, "MM-DD-YY").

The other mentioned are a detailed information, and contains a mixed blend of information. The table, chart, flowchart and the shapes contains different data type. However, text is a data type, and date can be converted into text date type through the above formula. Hence, we are converting the date data type to text data type.

Explanation:

The answer is self explanatory.

6 0
3 years ago
Which statement correctly describes the difference between an IP address and a MAC address for a
Citrus2011 [14]

The statement that correctly describes the difference between an IP address and a MAC address for a  specific device is that the IP address can change, but the MAC address always stays the same.

For better understanding, let us explain what the  IP address and a MAC address means

  • IP address simply mean Internet protocol address , it is a distinct string of numbers that is often separated by full stops that shows each computer using the Internet Protocol to link or communicate over a network.
  • MAC address is simply regarded as a A distinct number also as it shows a device or computer that is linked or connected to the internet.
  • One of the major difference between a MAC address and an IP address? is that the IP address gives the location of a device on the internet but the Mac address identifies the device connected to the internet.  

from the above, we can therefore say that the answer The statement that correctly describes the difference between an IP address and a MAC address for a  specific device is that the IP address can change, but the MAC address always stays the same, is correct

learn more about  IP address and a MAC address  from:

brainly.com/question/6839231

5 0
2 years ago
You have recently been hired as the new network administrator for a startup company. The company's network was implemented prior
AleksAgata [21]

Answer: • Physically secure high-value systems

• Identify and document each user on the network

Explanation:

To develop a manageable network plan, the milestones include:

• prepare to document

• mapping network,

• protect your network

• network accessibility

• user access etc...

When identifying ways to protect the network, the tasks that should be completed are:

•®Physically secure high-value systems

• Identify and document each user on the network

4 0
3 years ago
Other questions:
  • For Adults/Adolescents, you should call/activate EMS: Before providing CPR. After providing CPR for 2 minutes. After an AED has
    13·1 answer
  • What is one advantage of top-down programming design?
    13·2 answers
  • Write an if-else statement with multiple branches. If givenYear is 2100 or greater, print "Distant future" (without quotes). Els
    5·1 answer
  • The endocrine system is composed of many parts of the body.<br> a)True<br> b)False
    11·2 answers
  • (1) The Format Painter ___.
    5·1 answer
  • Which of these best represents a call to action?
    7·2 answers
  • What is the use of comma and semicolon with print statement ?​
    11·1 answer
  • Write a program that will read the payroll file. It should output the name and paycheck amount. Also output the total pay of all
    13·1 answer
  • You manage a network that uses switches. In the lobby of your building, there are three RJ45 ports connected to a switch. You wa
    5·1 answer
  • What dose a hard drive do
    8·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!