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
azamat
3 years ago
7

ad Libs are activities that have a person provide various words, which are then used to complete a short story in unexpected (an

d hopefully funny) ways. Complete the program to read the needed values from input, that the existing output statement(s) can use to output a short story. Ex: If the input is:

Computers and Technology
1 answer:
WINSTONCH [101]3 years ago
4 0

Answer:

Python

name =input("")  #input name

location = input("")  #input location

number = int(input(""))  #input number

pluralNoun = input("")  #input plural noun

print(name, 'went to', location, 'to buy', number, 'different types of', pluralNoun) #prints the short story using input variables

JAVA:

import java.util.Scanner;   // to accept input from user

public class Main {  

public static void main(String[] args) {  //start of main function

  Scanner input = new Scanner (System.in) ; //creates Scanner class object

   String subject;  //declares string type variable to hold name

   String location;  //declares string type variable to hold location

   int number;  //declares int type variable to hold number

   String object;  //declares string type variable to hold plural noun

  subject = input.next();  //reads input subject string value

  location = input.next();  //reads input location string value

  number = input.nextInt();  //reads input number integer value

  object = input.next();  //reads input object string value

  System.out.println(subject + " went to " + location + " to buy " + number + " different types of " + object + "."); } } //prints the short story using input values and existing string added with input values

In C++

#include <iostream> //to use input output functions

using namespace std; //to identify objects like cin cout

int main(){ //start of main function

   string first_name; // string variable that holds the first_name value

   cin>>first_name; //reads the first_name from user

   string generic_location; // string variable that holds the generic location

   cin>>generic_location; //reads the generic location  from user

   int whole_number; // int variable that holds the whole_number value

   cin>>whole_number; //reads the whole number  from user

   string plural_noun; // string variable that holds the plural_noun value

   cin>>plural_noun; //reads the plural_noun from user

cout<<first_name<<" went to "<< generic_location<<" to buy "<< whole_number<<" different types of "<<plural_noun;} //prints the short story using input values and existing string added with input values

Explanation:

The complete statement is:

If the input is:

Ex: If the input is

Eric

Chipotle

12

cars

Then the output is:  

Eric went to Chipotle to buy 12 different types of cars

Now to complete this program we read the needed values from input, that the existing output statements can use to output a short story.

If you look at the input Eric which is a name can be used as an input value as the name can be different for different users. Chipotle is a location that should aslo be an input value because locations can vary too of different users. 12 is a numeric that can also vary. For example a person can have more than or less than 12 cars. Lastly, cars which is  plural noun can also be used as input value. Now to get the above output we concatenated the input variables with the strings in the print statement in order to output a short story.

You can name the variables whatever you like as i have used different variable names in different programs.

You might be interested in
Write a program that deliberately contains an endless or infinite while loop. The loop should generate multiplication questions
Westkost [7]

Answer:

The Java code is given below with appropriate variable names for better understanding

Explanation:

import java.util.Random;

import java.util.Scanner;

public class MultiplicationQuestions {

   public static void main(String[] args) {

       Scanner scan = new Scanner(System.in);

       Random rand = new Random();

       int n1, n2, result, total = 0, correct = 0;

       char ch = 'y';

       while(ch == 'y'){

           n1 = 1 + rand.nextInt(9);

           n2 = 1 + rand.nextInt(9);

           System.out.print("What is "+n1+" * "+n2+" ? ");

           result = scan.nextInt();

           if(result==n1*n2){

               System.out.println("Correct. Nice work!");

               correct++;

           }

           else{

               System.out.println("Incorrect. The product is "+(n1*n2));

           }

           System.out.print("Want more questions y or n ? ");

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

           total++;

       }

       System.out.println("You scored "+correct+" out of "+total);

   }

}

3 0
3 years ago
The term embedded system refers to any device that includes a computer chip, but that is not a general-purpose workstation, desk
user100 [1]

 Any electronic system that uses a computer chip, but that is not a general-purpose workstation, desktop or laptop computer. Such systems use microcontrollers (MCUs) or microprocessors (MPUs), or they may use custom-designed chips.

4 0
2 years ago
How many times is the body of the loop executed?
Flura [38]

Answer:

The loop will run 5 times.

3 0
2 years ago
Hi weegy, what is the latest android os?
KatRina [158]
<span>The newest android os is:
Android 7.0 Nougat

</span>
7 0
3 years ago
what is the worst-case big o running time for finding the maximum value in an array of size n by scanning from left to right and
Aleksandr-060686 [28]

Answer:

spanish

Explanation:

no ingles a me pisquen spanish soy tu amigos teacher

6 0
1 year ago
Other questions:
  • Ushahidi is a crisis-mapping tool that makes information instantly available to anyone in the world. T/F
    10·1 answer
  • Typohunting is registering a domain name that is similar to a trademark or domain name but that is slightly misspelled in hopes
    5·1 answer
  • Assume that scotus is a two-dimensional character array that stores the family names (last names ) of the nine justices on the S
    6·1 answer
  • Why does a satellite requires two bridges?
    11·1 answer
  • Why it’s important to keep the standard internet protocol TCP/IP?
    11·1 answer
  • What's the name of this apex legend hero​
    13·2 answers
  • The advent of optical discs was made possible by developments in ____ technology.
    5·1 answer
  • Place the steps in order to link and place text into the document outline, effectively creating a master document.
    8·1 answer
  • Consider the following method.
    14·1 answer
  • The average American has 10 devices, ask for users average number of devices. Any number between 7 and 12 will print “you have a
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!