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
____ [38]
3 years ago
7

Write a function NumberOfPennies() that returns the total number of pennies given a number of dollars and (optionally) a number

of pennies. Ex: 5 dollars and 6 pennies returns 506.
Sample program:
#include
using namespace std;

int main() {
cout << NumberOfPennies(5, 6) << endl; // Should print 506
cout << NumberOfPennies(4) << endl; // Should print 400
return 0;
Computers and Technology
1 answer:
Over [174]3 years ago
4 0

Answer:

Following are the code to the given question:

#include <iostream>//header file  

using namespace std;

int NumberOfPennies(int ND, int NP=0)//defining a method that accepts two parameters  

{

return (ND*100 +NP);//use return keyword that fist multiply by 100 then add the value  

}

int main() //main method

{

cout << NumberOfPennies(5,6) << endl; // Should print 506

cout << NumberOfPennies(4) << endl; // Should print 400

return 0;

}

Output:

506

400

Explanation:

In the method "NumberOfPennies" it accepts two parameters that are "ND and NP" that uses the return keyword that multiply 100 in ND variable and add in NP variable and return its values.

In the main method it it uses the cout method that call the by accepts value in parameter and print its value.

You might be interested in
How are natural systems and engineered systems similar to one another?
erastovalidia [21]

They get the idea from nature and then the make engineered systems.That is how they are similar.

4 0
3 years ago
Why was the microchip essential to improving computers?
-BARSIC- [3]
Because it downsized the scale of the computer itself.

5 0
3 years ago
A game design company develops a game in which players run a grocery store and need to keep tabs on the dollar amount of goods s
sdas [7]
I do believe it is Inventory management but I can never tell if it is the right answer. so my regards if it the wrong answer.

6 0
3 years ago
What are the things the child sees on his way the fair why does he log behind​
Papessa [141]

Hope this helps you.. Sorry for the handwriting.

7 0
3 years ago
For activities with output like below, your output's whitespace (newlines or spaces) must match exactly. See this note. Jump to
Vinvika [58]

Answer:

The program to this question can be given as:

Program:

#include<stdio.h>//include header file

int main() //defining main method

{

printf("Hello..! and please vote the answer."); //print value.

return 0;

}

Output:

Hello..! and please vote the answer.

Explanation:

In the given question some information is missing that is the message to be printed, In this code assume some message to be displayed, and the description to the above code as follows:

  • In the above code firstly header file is included for using a basic function like print method, input method, etc.
  • In the next line main method is defined, inside the main method a print function is used in this function a message is passed with a double-quote ("'). When the code will execute it will print the message that is given in the output section.

5 0
2 years ago
Other questions:
  • A customer states that when she removes the printed pages from her laser printer output tray, the black ink smears all over her
    10·1 answer
  • Please help me!! 10 Points are waiting!!
    8·1 answer
  • Are you concerned that strangers may have access to the personal information you share on social media platforms? Why or why not
    10·1 answer
  • What is GND and what color wire do we connect to GND? (this is like for circuits and stuff btw)
    7·1 answer
  • Select the correct answer.
    10·1 answer
  • You received an email message stating that your mother's bank account is going to be forfeited if you do not respond to the emai
    6·1 answer
  • Explain Http and Ftp​
    12·1 answer
  • You've just finished installing a wireless access point for a client. What should you do to prevent unauthorized users from usin
    15·1 answer
  • What's the commission payout for auto bill pay if sold with a ga?
    6·1 answer
  • On the line below, write the two places you can control tab settings.
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!