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
VMariaS [17]
3 years ago
8

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

nd hopefully funny) ways.Write a program that takes a string and integer as input, and outputs a sentence using those items as below. The program repeats until the input string is quit 0.Ex: If the input is:apples 5shoes 2quit 0the output is:Eating 5 apples a day keeps the doctor away.Eating 2 shoes a day keeps the doctor away.Note: This is a lab from a previous chapter that now requires the use of a loop.import java.util.Scanner;public class LabProgram {public static void main(String[] args) {/* Type your code here. */}}

Computers and Technology
1 answer:
Marina86 [1]3 years ago
3 0

Answer:

I am writing a C++ and JAVA program.    

import java.util.Scanner; //for using input output functions

public class LabProgram { // class name

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

Scanner input = new Scanner(System.in);

// creates input instance of  Scanner type

     String str;  // declares String type variable str for a string value

     int num;  // declares integer type variable num to hold an integer value

     str = input.next(); //scans and reads input string from user

     num = input.nextInt();  //scans and reads input integer from user

//while loop continues to execute until user enters quit 0

while(str!="quit" && num!=0) {  

/* prints the following message, for example if value of num = 2 and value of str = apples then the following print statement prints Eating 2 apples a day keeps the doctor away. */

System.out.println("\nEating " + num +" " + str + " a day keeps the doctor away.");

//takes string and integer as input again and keep taking input until user //enters quit 0

str = input.next();  

num = input.nextInt(); }   } }

Explanation:

The program is well explained in the comments mentioned with each statement of the program. The program simply prompts user to enter a string and an integer. The while loop keeps executing until user enters quit 0. The program keeps taking input string and integer from user and prints the message System.out.println("\nEating " + num +" " + str + " a day keeps the doctor away.");  The loop breaks when the use enters quit 0. The screenshot of the program along with its output is attached.

You might be interested in
If you hold down the alt key and click anywhere in your document what happens
sukhopar [10]
<span>The Alt key on a PC is utilised to change the capacity of other squeezed keys. It will go to any desired short cut in the computer that is being accessed. in short , one can use this to reach other functionality of a windows based computer easily. For example, if you were accessing documents and you want to skip to a different function from what you were doing on the desktop.</span>
4 0
3 years ago
Computer viruses often spread by means of what?
lozanna [386]
Email attachments hope this helps
8 0
3 years ago
Read 2 more answers
What is a good way to become a game developer without spending a lot of money?
Stels [109]

Answer:

Codes

Explanation:

learn the codes first. when you're already expert, you'll find ways from there.

8 0
3 years ago
What are the types of Operating System​
Archy [21]

Answer:

1. Gestión de la memoria principal

Esta es una característica del sistema operativo básica. La memoria principal de la computadora almacena los datos que serán usados por el CPU en la ejecución de los programas. El sistema operativo se encarga de gestionarla, es decir, asignar partes de memoria a la nueva información usada, y evitar que se sature.

2. Gestión de la memoria secundaria

Es la memoria más “permanente” de una computadora. Al igual que la memoria principal, el SO sistema operativo asigna el orden de guardado en esta memoria y la mejor manera de aprovechar el espacio libre.  

3. Gestión de procesos

Cuando envías un comando para que el ordenador realice una tarea, una de las funciones del sistema operativo es organizar los recursos de la computadora para ejecutarla. Esto incluye la memoria, el tiempo del CPU, los programas y archivos necesarios para ejecutar la tarea, los procesos que podrían entorpecerla y los periféricos que podrían ser necesarios para cumplirla.

4. Gestión de recursos  

¡Esta es una de las características del sistema operativo más importantes! El sistema operativo coordina los recursos del hardware que integra la computadora para cumplir con las tareas requeridas. El CPU, los periféricos, las memorias principal y secundaria, los programas, todo tiene que trabajar al unísono para cumplir con las tareas de forma óptima.

5. Gestión de usuarios  

El software operativo controla el acceso de los usuarios a las cuentas individuales o grupales. También, se encarga de administrar a qué recursos e información tiene acceso cada uno de ellos.  

6. Gestión de la seguridad  

Así como controla el acceso de usuarios, el sistema operativo también está encargado de gestionar los controles de seguridad de la computadora, entre ellos el firewall. Por ejemplo, en cuanto a la función del sistema operativo para la seguridad informática es evitar la pérdida de datos, controlar la confidencialidad de los datos y controlar el acceso a la información y a los recursos del equipo.

5 0
3 years ago
What creates a challenge with night photography?
Nikolay [14]

Answer:

low light levels

It's night photography which means you are taking photographs at night. At nighttime, there isn't much light because the sun isn't out.

Explanation:

6 0
3 years ago
Other questions:
  • divide the input array into thirds (rather than halves), recursively sort each third, and finally combine the results using a th
    15·1 answer
  • Blank spaces or unseen control characters in a data file are referred to as
    5·2 answers
  • Speed is how fast an object moves a certain distance within a length of time. How is speed calculated?
    14·2 answers
  • Write a complete Java program called Stewie2 that prints the following output. Use at least one static method besides main. ////
    9·2 answers
  • Traveling abroad to have sex with underage children is known as?
    11·2 answers
  • A user reports network resources can no longer be accessed. The PC reports a link but will only accept static IP addresses. The
    6·1 answer
  • The following is a true example of a computer: A. Toyota Camry
    12·1 answer
  • This image shows a web designer's grids for different pages on a website. The uppermost box on each page is the website's identi
    14·2 answers
  • Should a UDP packet header contain both Sour Port # and Destination Port #?
    7·1 answer
  • You are creating a web page as part of a science project. Your role is to put your data on the webpage. You tracked the growth o
    12·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!