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
Create and integrate a script on the registration.html page that stores the input field data into hidden fields to be used in th
Pavel [41]

Answer:

Explanation:

// CAPTURE QUERY STRING VALUES

var urlParams = new URLSearchParams(location.search);

var uid = urlParams.get('userName');

var fName = urlParams.get('firstName');

var lName = urlParams.get('lastName');

var pass = urlParams.get('password');

var email = urlParams.get('email');

var phone = urlParams.get('phoneNumber');

var signUp = urlParams.get('signUpNewsletter');

=====================================

Modified the checkbox control into multiple control

<div>

<select id="interests" name="interests" multiple>

<option value="Technology">Technology</option>

<option value="Music">Music</option>

<option value="Movies">Movies</option>

</select>

</div>

==================================

Added a js function to read multiple input values

function getSelectValues(select) {

var result = [];

var options = select && select.options;

var opt;

for (var i=0, iLen=options.length; i<iLen; i++) {

opt = options[i];

if (opt.selected) {

result.push(opt.value || opt.text);

}

}

return result;

}

==============================

Below is how I create cookie object

ar data =

{

uid:document.myForm.userName.value,

fName: document.myForm.firstName.value,

lName: document.myForm.lastName.value,

pass: document.myForm.password.value,

email: document.myForm.email.value,

phone:document.myForm.phoneNumber.value,

signUp: document.myForm.signUpNewsletter.value,

interests: getSelectValues(document.myForm.interests).toString(),

comment: document.myForm.comment.value,

referredBy: document.myForm.referredBy.value,

};

var dataString = "uid=" + data.uid + ",fName=" + data.fName + ",lName=" + data.lName + ",pass=" + data.pass + ""+ +",email=" + data.email + ",phone=" + data.phone + ",signUp=" + data.signUp + ",interests=" + data.interests + "" + +",comment=" + data.comment + ",referredBy=" + data.referredBy + "";

===========

Make sure you write last line in single line

3 0
3 years ago
WHAT DOES THE SCRATCH CODE BELOW DO?
Vinil7 [7]
I think it’s b vertically
7 0
3 years ago
Localize the software problem and describe it<br>​
sweet [91]

Answer:

Do you have any idea how to get the best and most importantly I

5 0
3 years ago
Explain why regular system cleanup is vital to ensuring the operating system runs efficiently.
Monica [59]
Cleaning up a system helps clear up the space on the drives. It may also clear up processor usage, ram usage if you uninstall programs that automatically started when the system booted. You may also delete some unwanted programs in the process.
6 0
3 years ago
When computer criminals launch an intentional attack in which a malicious hacker floods a server with millions of bogus service
makkiz [27]
I'm pretty sure it's a DDOS or DOS attack
6 0
4 years ago
Other questions:
  • Which statement about word processing software is true? A)You can use it to perform mathematical calculations.B) You can use it
    6·2 answers
  • If you use the ___ template, as opposed to a formatted theme, you must make all design decisions?
    15·1 answer
  • Given the list my_list containing integers, create a list consisting of all the even elements of my_list. Associate the new list
    12·1 answer
  • To define constructors and member functions outside of a class's original scope, the operator can be used.
    11·1 answer
  • If you're able to understand directions more easily when you hear them instead of reading them you are most likely
    12·1 answer
  • How can a network design project benefit from the principles of itsm? How might itsm impede a network design project?
    11·1 answer
  • In addition to using the icons to adjust page margins, a user can also use _____.
    7·2 answers
  • A new systems development project is Pete’s first experience as a project manager, and he has led his team successfully to the p
    13·1 answer
  • Why is it important to enforce access controls and to keep logs regarding who has access to data closets
    14·2 answers
  • Which three options below describe typographic hierarchy?
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!