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
Kay [80]
4 years ago
11

Assignment 1 is to write a program that will write the lyrics to "X number of beers on the wall". Use only the main method. Prom

pt for the initial number of bottles of beer on the wall. Confirm the value is greater than zero and less than 101. Your program should then generate the following console output. The example below assumes the number 3 has entered. You loop each time until there are 0 bottles of beer on the wall. 3 bottles of beer on the wall. 3 bottles of beer. Take 1 down, pass it around. 2 bottles of beer on the wall. 2 bottles of beer on the wall. 2 bottles of beer. Take 1 down, pass it around. 1 bottle of beer on the wall. 1 bottle of beer on the wall. 1 bottle of beer. Take 1 down, pass it around. 0 bottles of beer on the wall.
Computers and Technology
1 answer:
g100num [7]4 years ago
4 0

Answer:

// here is code in java.

import java.util.*;

class Main

{

// main method of the class

public static void main (String[] args) throws java.lang.Exception

{

   try{

       // variable to store the number of bottles

       int num_bot;

        Scanner scr=new Scanner(System.in);

        System.out.print("Enter number of bottles of beer on the wall:");

        //read the number of bottles

        num_bot=scr.nextInt();

        // print the output

        for(int i=num_bot;i>0;i--)

        {

         // print the first statement

         System.out.println(i+" beer bottles on the wall");

         // print the second statement

         System.out.println(i+" beer bottles . Take 1 down and pass the bottle around.");

         }

         // when there is 0 bottle

           System.out.println("0 bottles of beer on the wall.");

   }catch(Exception ex){

       return;}

}

}

Explanation:

Declare a variable "num_bot" to store the initial number of beer bottles.Then ask user to give number of bottles.Run a for loop to pass a beer bottle until there is 0 bottle on the wall. When number of bottle is 0 then it will print there is "0 bottle on the wall".

Output:

Enter number of bottles of beer on the wall:3

3 beer bottles on the wall

3 beer bottles . Take 1 down and pass the bottle around.

2 beer bottles on the wall

2 beer bottles . Take 1 down and pass the bottle around.

1 beer bottles on the wall

1 beer bottles . Take 1 down and pass the bottle around.

0 bottles of beer on the wall.

You might be interested in
How many wires are in a standard Cat 6 cable?
Lynna [10]
I believe it is 8

Hope this helps
5 0
3 years ago
Read 2 more answers
When you get a new sim card do it come with a new number or do you have a activate the phone and get a new number in store ?
Paul [167]

put the sim card in the phone and turn the phone on, it technically comes with the card but you really interact with it until you turn the phone on.

5 0
3 years ago
You want to know your grade in Computer Science, so write a program that continuously takes grades between 0 and 100 to standard
Dominik [7]

Answer:

Following are the program in the Python Programming Language.

#declare variables and initialize to 0

s=0

n=0

avg=0

#set the infinite while loop  

while(True):

 #get input from the user

 score=input()

 #set if statement to break loop

 if(score =="stop"):

   break

 #otherwise, perform calculation

 else:  

   n+= 1

   s=s+ int(score)

   avg= s/n

#print average of the input

print ('average: ',avg)

<u>Output</u>:

58

96

34

15

stop

average:  50.75

Explanation:

<u>Following are the description of the program</u>.

  • Firstly, set three variable that is 's' for sum, 'n' for count and 'avg' for average and initialize them to 0.
  • Set the infinite while loop and inside it, set variable 'score' that get input from the user then, set the if conditional statement for break the loop, otherwise we calculate the sum of the user input and calculate its average.
  • Finally, we print the result with message.
6 0
3 years ago
What is the annotation method of note-taking? select one:
n200080 [17]
<span>Divides your paper into two columns: the notetaking column (usually on the right) is twice the size of the key word column (on the left).

so the answer is A
</span>
4 0
3 years ago
Are these correct, if not then please correct me!​
Tanya [424]

Answer:

1 is incorrect, A is the whole oval. B doesn't matter.

2 is correct

3 is incorrect, the shared part belongs to A or B as well

4 is correct

5 is correct

6 is correct

7 is correct

8 is correct (compare to 3, it should be the inverse!)

9 is incorrect, only B with A excluded must be shaded

10 is incorrect, the whole of A must be included

Explanation:

If you point to any place in the picture, you must be able to evaluate the expression to "TRUE". Take number 10, if you point to the shared area of A and B, you can say "A or !B" is TRUE because you are inside A, so the expression is TRUE or FALSE which is TRUE.

5 0
3 years ago
Other questions:
  • If you can log nto a website to add, edit, or delete content that has been added by you or another user , you are most likley us
    8·1 answer
  • True or False?
    8·1 answer
  • Carol purchases a computer. She installs speech recognition software on the computer.
    9·1 answer
  • You have several marketing documents that are published through AD RMS. However, you have three new marketing employees that req
    12·1 answer
  • All data process by a computer must be in 1. binary form 2. Hexadecimal form 3. Duodecimal form 4. Unitary form?
    11·2 answers
  • In which case will the linear search return the lowest value faster than the<br> binary search?
    13·1 answer
  • The average number of entities completed per unit time -- the output rate -- from a process is called ____.
    9·1 answer
  • Ashley has many interests. She likes to read, listen to music, and play soccer with her friends. But her favorite thing to do is
    9·1 answer
  • A python program for the following output using for loop.
    13·1 answer
  • IDENTIFYING VERBS THAT AGREE IN NUMBER WITH THEIR SUBJECTS For each of the following sentences, write the correct form of the ve
    13·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!