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
White raven [17]
3 years ago
5

Complete function PrintPopcornTime(), with int parameter bagOunces, and void return type. If bagOunces is less than 2, print "To

o small". If greater than 10, print "Too large". Otherwise, compute and print 6 * bagOunces followed by " seconds". End with a newline. Example output for ounces.1 #include 2 using namespace std; 34 void PrintPopcornTime (int bagOunces)5 6 Your solution goes here 10 int main) 7891011 PrintPopcornTime(7) 12 13 return 0 14
Computers and Technology
1 answer:
Ludmilka [50]3 years ago
4 0

Answer:

#include <iostream>

using namespace std;

void PrintPopcornTime (int bagOunces){

   if (bagOunces < 2){

       cout << "Too small"<<endl;

   }

   else if (bagOunces > 10){

       cout << "Too large"<<endl;

   }

   else{

       cout << bagOunces*6 <<" seconds"<<endl;

   }

}

int main(){

   PrintPopcornTime(7);

   

   return 0;

}

Explanation:

Create a function called PrintPopcornTime that takes one parameter, bagOunces

Check the bagOunces using if-else structure. If it is smaller than 2, print "Too small". If it is greater than 10, print "Too large". Otherwise, calculate and print 6*bagOunces followed by " seconds".

Call the function in the main function with parameter 7. Since 7 is not smaller than 2 or not greater than 10, "42 seconds" will be printed.

You might be interested in
What is the main purpose of web crawler program ?
alexgriva [62]

Answer:

To index web pages for quick retrieval of content

Explanation:

ap3x verified

6 0
3 years ago
1. Write a telephone lookup program. Read a data set of 1, 000 names and telephone numbers from a file that contains the numbers
Fed [463]

Answer:

Kindly note that, you're to replace "at" with shift 2 as the brainly text editor can't take the symbol

Explanation:

PhoneLookup.java

import java.io.FileReader;

import java.io.IOException;

import java.util.Scanner;

public class PhoneLookup

{

  public static void main(String[] args) throws IOException

  {

     Scanner in = new Scanner(System.in);

     System.out.println("Enter the name of the phonebook file: ");

     String fileName = in.nextLine();

     LookupTable table = new LookupTable();

     FileReader reader = new FileReader(fileName);

     table.read(new Scanner(reader));

   

     boolean more = true;

     while (more)

     {

        System.out.println("Lookup N)ame, P)hone number, Q)uit?");

        String cmd = in.nextLine();

       

        if (cmd.equalsIgnoreCase("Q"))

           more = false;

        else if (cmd.equalsIgnoreCase("N"))

        {

           System.out.println("Enter name:");

           String n = in.nextLine();

           System.out.println("Phone number: " + table.lookup(n));

        }

        else if (cmd.equalsIgnoreCase("P"))

        {

           System.out.println("Enter phone number:");

           String n = in.nextLine();

           System.out.println("Name: " + table.reverseLookup(n));

        }

     }

  }

}

LookupTable.java

import java.util.ArrayList;

import java.util.Collections;

import java.util.Scanner;

/**

  A table for lookups and reverse lookups

*/

public class LookupTable

{

  private ArrayList<Item> people;

  /**

     Constructs a LookupTable object.

  */

  public LookupTable()

  {

      people = new ArrayList<Item>();

  }

  /**

     Reads key/value pairs.

     "at"param in the scanner for reading the input

  */

  public void read(Scanner in)

  {

     while(in.hasNext()){

         String name = in.nextLine();

         String number = in.nextLine();

         people.add(new Item(name, number));

     }

  }

  /**

     Looks up an item in the table.

     "at"param k the key to find

     "at"return the value with the given key, or null if no

     such item was found.

  */

  public String lookup(String k)

  {

     String output = null;

     for(Item item: people){

         if(k.equals(item.getName())){

             output = item.getNumber();

         }

     }

     return output;

  }

  /**

     Looks up an item in the table.

     "at"param v the value to find

     "at"return the key with the given value, or null if no

     such item was found.

  */

  public String reverseLookup(String v)

  {

      String output = null;

         for(Item item: people){

             if(v.equals(item.getNumber())){

                 output = item.getName();

             }

         }

         return output;

  }

}

Item.java

public class Item {

  private String name, number;

 

  public Item(String aName, String aNumber){

      name = aName;

      number = aNumber;

  }

 

  public String getName(){

      return name;

  }

 

  public String getNumber(){

      return number;

  }

}

input.txt

Abbott, Amy

408-924-1669

Abeyta, Ric

408-924-2185

Abrams, Arthur

408-924-6120

Abriam-Yago, Kathy

408-924-3159

Accardo, Dan

408-924-2236

Acevedo, Elvira

408-924-5200

Acevedo, Gloria

408-924-6556

Achtenhagen, Stephen

408-924-3522

Kindly check the attached output image below.

3 0
3 years ago
Erin previously recorded all of her credit card activity manually using the expense transaction screen. She then reconciled the
-Dominant- [34]

Answer:

she should select reconciled account, then select batch actions and lastly exclude selected

Explanation:

Erin should reconcile her account if she cannot see the matches for the transactions that she entered and reconciled previously.

Banks use reconciliation methods to evaluate the transactions that are reported internally against monthly financial statements.

Erin has to take these steps:

Select reconciled transactions, then select batch actions and lastly exclude selected ones

4 0
3 years ago
What word is used today to refer to network-connected hardware devices?
Alina [70]

endpoint is the word used today to refer to network-connected hardware devices.

An endpoint is a network-connected hardware device, such as a computer, printer or smartphone. Today, the term endpoint is used to refer to any device that can be connected to a network.

Endpoints are important because they are the devices that users interact with when they access a network. For example, when you log into a website, you are using an endpoint (your computer) to connect to a server.

Endpoints can be either physical or virtual. Physical endpoints are actual hardware devices, while virtual endpoints are software-based and run on top of physical hardware.

Most endpoint security solutions focus on physical devices, but as more and more devices become virtual, it's important to consider security for both physical and virtual endpoints.

Learn more on endpoints here:

brainly.com/question/28221902

#SPJ4

8 0
2 years ago
Write a Java Program
Helga [31]

In the Deck Builder, initialize the 52 cards (along with the 4 jokers, which should be called “wild” and the suit is “wild”).

<h3>Public class Deck</h3>

  private final List<Carta> Deck;

  public Baralho() {

      listaCartas = new ArrayList<>();

      String[] naipes = {"club", "spade", "heart", "diamond"};

      int pos = 0;

      Carta c;

With this code we will be able to create the Deck, initialize the 52 cards together with the 4 jokers.

Learn more about Deck in brainly.com/question/1660537

8 0
2 years ago
Other questions:
  • In the windows firewall, any rules preceded by a __________ checkmark have not been enabled. black gray green red
    13·1 answer
  • A label is any word that appears in a cell of a spreadsheet.<br> True<br> False
    5·2 answers
  • One of the attributes in a table in your database depends on another attribute for its meaning. What type of dependency has been
    14·1 answer
  • What process combines data from a list with the content of a document to provide personalized documents?
    9·2 answers
  • Write a class called (d) Teacher that has just a main method. The main method should construct a GradeBook for a class with two
    7·1 answer
  • ____ technology essentially takes the data to be transmitted and rather than transmitting it in a fixed bandwidth spreads it ove
    15·1 answer
  • Name similarities between innovation and invention
    6·1 answer
  • Describe how you would define the relation Brother-in-Law whose tuples have the form (x, y) with x being the brother-in-law of y
    9·1 answer
  • Define the terms candidate key and primary key. Explain the difference between a primary key and a candidate key.
    9·1 answer
  • I will mark you as BRAINLIEST if you give me the correct answer of the questions... Pls asap with all details i am time limited
    15·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!