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
Mary is troubleshooting her company's LAN network. She finds out that data segments that the client is encoding are resulting in
kicyunya [14]

Answer:

Data link layer of OSI model is creating the erroneous segments

Explanation:

The Open System Interconnection (OSI) model is a conceptual framework about how communication occurs between devices over the Internet. It has seven layers, (Physical, Data, Network, Transport, Session, Presentation and Application layer). The purpose of this hierarchical layer system is to understand the structure of communication between devices and do troubleshooting easily if a fault occurs. As in this question, Marry is troubleshooting her company LAN network. She finds out that data segments that the client is encoding are resulting in errors in the encoding. Now the question arises, how she found the cause of the error. The OSI model helps her in understanding the problem.

As you know, the data link layer of the OSI model is responsible for the encoding and decoding of data segments. This layer ensures the reliability of the physical layer, and responsible to provide error-free transfer of data from one node to another on a network. It is also responsible for frame synchronization and flow control. The data link layer is divided into sub-layers:

1. Media Access Control Layer: this layer controls how a computer on the network gains access to the data and transmission permission.

2. Logical Link Control Layer: This layer controls frame synchronization, error checking and flow control.

Therefore, Marry founds data link layer of the OSI model is creating the erroneous segments in encoding.

6 0
3 years ago
High level language is___________
lara31 [8.8K]

Answer:

B. Machine dependent and machine oriented pls mark me branilest

8 0
2 years ago
Hurry plz
Elanso [62]

Answer: It allows you to locate materials, be aware of your assignments and plan time to get things done.

Hope it helped.

3 0
3 years ago
Which of the following statements is not true of web storage?
slavikrds [6]

Answer:

The data in web storage is passed to the server with every HTTP request.

Explanation:

There are basically two Web storage APIs Session storage and local storage.Both can store data up to 5MB. They are supported by every modern browser.You can store data in local storage indefinitely and for browser session in session storage.There is no data or information in HTTP request header.So we conclude that option 4 is the answer.

3 0
2 years ago
PLS HELP ASAP- Select the correct text in the passage.
SCORPION-xisa [38]

Answer:

reread the text

Explanation:

I do it it helps

5 0
2 years ago
Read 2 more answers
Other questions:
  • Write a program for playing tic tac toe. Two players take turns marking an available cell in a 3 X 3 grid with their respective
    15·1 answer
  • Can someone pls explain this question??
    7·1 answer
  • The Table Tools tab provides which two additional tabs?
    5·1 answer
  • Whats the difference between copying a file to my desktop and creating a shortcut?
    8·1 answer
  • Im being timed please help!!
    7·2 answers
  • Which computer company was named after an orchard? dell, apple, or ibm
    11·1 answer
  • Match each type of software license with the appropriate definition.
    11·1 answer
  • We define the following terms:
    11·1 answer
  • A computer virus is a program that can copy itself and infect a computer without the permission of the owner. How do you think a
    9·1 answer
  • Which of the following IS an operating system? *<br> Reddit<br> Ubuntu<br> Office 365<br> Mac Pro
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!