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
Grace [21]
2 years ago
12

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

r of pennies. Ex: If you have $5.06 then the input is 5 6, and if you have $4.00 then the input is 4. Sample output with inputs: 5 6 4 506 400
Computers and Technology
2 answers:
KonstantinChe [14]2 years ago
7 0

Answer:

Code is given as:-

#number_of_pennies function with one default argument with pennies as 0 when no pennies parameter is given

def number_of_pennies(dollars,pennies = 0):

  pennies = dollars*100 + pennies #one dollar equals 100 pennies so calculate total pennies with this formula

  return pennies #return total pennies

print(number_of_pennies(int(input()),int(input()))) #both Dollars and pennies

print(number_of_pennies(int(input()))) #Dollars only

Explanation:

Here is the sample code and output.

katovenus [111]2 years ago
5 0

Answer:

The function is as follows:

def number_of_pennies(dollars,pennies=0):

   return dollars*100+pennies

   

Explanation:

This defines the function

def number_of_pennies(dollars,pennies=0):

This returns the number of pennies

   return dollars*100+pennies

<em>Note that, if the number of pennies is not passed to the function, the function takes it as 0</em>

You might be interested in
Write down the stages in the information prcessing cycle in correct order​
Naddika [18.5K]

Answer:

The answer is below

Explanation:

The various stages in the information processing cycle in the correct order​ is as follows:

1. Input stage: this is when the data is sent into the computer through the hardware

2. Processing stage: this when the is being refined in the central processing unit of the computer

3. Storage stage: this is when the data is being saved or stored in the computer memory such as Hard drive or external storage such as Flash drive

4. Output stage: this is when the refined or processed data is produced to the user either through the monitor screen or printing

4 0
3 years ago
This program will store roster and rating information for a soccer team. Coaches rate players during tryouts to ensure a balance
Simora [160]

Answer:

// Scanner class is imported to allow program receive user input

import java.util.Scanner;

// class is defined

public class PlayerRoster {

   // main method that begin program execution

  public static void main(String[] args) {

   // Scanner object scan is defined

     Scanner scan = new Scanner(System.in);

   // multi-dimensional array to hold the jersey number and rating

     int[][] players = new int[5][2];

   // boolean flag to keep program alive

     boolean keepAlive = true;

   // the user input is declared as input of type char

     char input;

     

   // for loop that receive 5 player jersey number and ratings

   // it assigns the received input to the already initialized array

     for (int i = 0; i < 5; i++) {

        System.out.println("Enter player " + (i+1) + "'s jersey number: ");

        players[i][0] = scan.nextInt();

        System.out.println("Enter player " + (i+1) + "'s rating: ");

        players[i][1] = scan.nextInt();

        System.out.println();

     }

   // a blank line is printed

     System.out.println();

   // a method is called to display players array

     outputRoster(players, 0);

     

   // while the flag is true

   // display the Menu by calling the outputMenu method

     while (keepAlive) {

        outputMenu();

       // user input is assigned to input

        input = scan.next().charAt(0);

       //  if user input is 'q' then program will quit

        if (input == 'q') {

           keepAlive = false;

           break;

        }

       //  else if input is o, then outputRoaster is called to display players

        else if (input == 'o') {

           outputRoster(players, 0);

        }

       //  else if input is 'u', then user is allowed to edit a player rating

        else if (input == 'u') {

           System.out.println("Enter a jersey number: ");

           int jerseyNum = scan.nextInt();

           System.out.println("Enter a new rating for the player: ");

           int newRating = scan.nextInt();

           for (int l = 0; l < 5; l++) {

              if (players[l][0] == jerseyNum) {

                 players[l][1] = newRating;

              }

           }

        }

       //  else if input is 'a', user is allowed to add a new rating

        else if (input == 'a') {

           System.out.println("Enter a rating: ");

           int rating = scan.nextInt();

           outputRoster(players, rating);

        }

        // else if input is 'r', user is allowed to replace a player

        else if (input == 'r') {

           System.out.println("Enter a jersey number: ");

           int jerseyNum = scan.nextInt();

           boolean exists = true;

           for (int l = 0; l < 5; l++) {

              if (players[l][0] == jerseyNum) {

                 System.out.println("Enter a new jersey number: ");

                 players[l][0] = scan.nextInt();

                 System.out.println("Enter a rating for the new player: ");

                 players[l][1] = scan.nextInt();

              }

           }

           

        }

     }

     

     return;

  }

 

// this method take two parameters, players and min

// it then returns player with ratings greater than min

  public static void outputRoster(int[][] players, int min) {

     System.out.println(((min>0) ? ("ABOVE " + min) : ("ROSTER")));

     int item = 1;

     for (int[] player : players) {

        if (player[1] > min) {

           System.out.println("Player " + item + " -- Jersey number: " + player[0] + ", Rating: " + player[1]);

        }

        item++;

     }

     System.out.println();

  }

 

// outputMenu method to display the program menu

  public static void outputMenu() {

     System.out.println("MENU");

     System.out.println("u - Update player rating");

     System.out.println("a - Output players above a rating");

     System.out.println("r - Replace player");

     System.out.println("o - Output roster");

     System.out.println("q - Quit\n");

     System.out.println("Choose an option: ");  

  }

}

Explanation:

The program is written in Java and it is well commented.                                          

5 0
3 years ago
Halp Computer Science
AleksandrR [38]

1st one: is memory

2nd one: is 8

8 0
3 years ago
Read 2 more answers
What do you consider to be audit evaluation areas?
skelet666 [1.2K]

Answer:

<em>communications</em><em>,</em><em>risk</em><em>,</em><em>systems</em><em>,</em><em>test</em><em>ins</em><em>,</em><em>procedures</em><em>,</em><em>interviews</em><em>,</em><em>documents</em><em>.</em>

Explanation:

The auditor considers many factors in determining the nature, timing, and extent of auditing procedures to be performed in an audit of an entity's financial statements. One of the factors is the existence of an internal audit function. fn 1 This section provides the auditor with guidance on considering the work of internal auditors and on using internal auditors to provide direct assistance to the auditor in an audit performed in accordance with generally accepted auditing standards.Note: When performing an integrated audit of financial statements and internal control over financial reporting, refer to paragraphs 16-19 of PCAOB Auditing Standard No. 5, An Audit of Internal Control Over Financial Reporting That Is Integrated with An Audit of Financial Statements, for discussion on using the work of others to alter the nature, timing, and extent of the work that otherwise would have been performed to test controls.

Roles of the Auditor and the Internal Auditors

<em>02 </em>

<h2><em>I</em><em> </em><em>HOPE</em><em> </em><em>THIS</em><em> </em><em>HELPS</em><em> </em><em>ALOT</em><em>!</em><em> </em><em>:</em><em>3</em></h2>

3 0
3 years ago
Which of the following words is an anatomy for cautious
liraira [26]
Uh, I think you mean antonym.

Anyways, here are some antonyms.

Careless, Certain, Foolish, Inattentive, Incautious
8 0
3 years ago
Other questions:
  • . Write a recursive function names factorial to compute the factorial of the parameter. Also write the main function, where you
    15·1 answer
  • When information about a person remains on the internet indefinitely it is known as?
    6·1 answer
  • Liz's meeting is scheduled to end at 9:30. It is 9:20 and team
    9·1 answer
  • What is wrong with my code?
    7·1 answer
  • When an item in a menu is black, it means that _____.
    6·2 answers
  • Plssssssssssssss help quick
    8·1 answer
  • Wilma is looking for facts about social media for her research project. What fact should she use for her project?
    15·1 answer
  • What type of formula uses data from multiple worksheets
    6·1 answer
  • Define artificial intelligence?​
    15·2 answers
  • The chain of _____ documents that the evidence was under strict control at all times and no unauthorized person was given the op
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!