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
Slav-nsk [51]
3 years ago
9

Write a program that will use user input. The program should be called PrintNumberToWordie which prints "ONE", "TWO",..., "FIVE"

UP to TEN if the int variable "number" is 1, 2,..., 5, 10, respectively be sure to code for the else/default option if no match is found.
This program must Use (a) a "nested-if" statement to complete; (b) Secondly the program must have an additional if statement to check to see if the user input is divisible by 2.
Computers and Technology
1 answer:
andrezito [222]3 years ago
5 0

Answer:

import java.util.Scanner;

public class PrintNumberToWordie {

   public static void main(String[] args) {

       Scanner in = new Scanner(System.in);

       System.out.println("Enter a number");

       int num = in.nextInt();

       if(num == 1){

           System.out.println("ONE");

           if(num%2==0)

               System.out.println("Divisible by 2");

       }

       else if (num == 2){

           System.out.println("TWO");

           if(num%2==0)

               System.out.println("Divisible by 2");

       }

       else if (num == 3){

           System.out.println("THREE");

           if(num%2==0)

               System.out.println("Divisible by 2");

       }

       else if (num == 4){

           System.out.println("FOUR");

           if(num%2==0)

               System.out.println("Divisible by 2");

       }

       else if (num == 5){

           System.out.println("FIVE");

           if(num%2==0)

               System.out.println("Divisible by 2");

       }

       else if (num == 6){

           System.out.println("SIX");

           if(num%2==0)

               System.out.println("Divisible by 2");

       }

       else if (num == 7){

           System.out.println("SEVEN");

           if(num%2==0)

               System.out.println("Divisible by 2");

       }

       else if (num == 8){

           System.out.println("EIGHT");

           if(num%2==0)

               System.out.println("Divisible by 2");

       }

       else if (num == 9){

           System.out.println("NINE");

           if(num%2==0)

               System.out.println("Divisible by 2");

       }

       else if (num == 10){

           System.out.println("TEN");

           if(num%2==0)

               System.out.println("Divisible by 2");

       }

       else{

           System.out.println("No Match");

       }

 }

}

Explanation:

  • Using Java programming language
  • Import Scanner class
  • Prompt user to enter a number, receive and store in a variable
  • Use if and else if statements to check the value of the number and output the corresponding spelling
  • Use and inner if statement to check divisibility by two using the modulo operator
You might be interested in
Describe a real or made up but possible example of a product that went through a time of scarcity. What was likely to happen to
NeX [460]

Last 2012, there was a virus which infected millions of chicken. It was known as Avian influenza or bird flu. It resulted to scarcity of eggs. As the law of supply and demand states, there is an effect on the price of a product depending on its availability. If there is a low supply and a high demand, there is an increase in price and vice versa. 

4 0
3 years ago
What is meaning of geo and bio​
Aleks [24]

Answer:

GEO. genetically enhanced organism. Medical, Health, Healthcare.

The word biology is derived from the greek words /bios/ meaning /life/ and /logos/ meaning /study/ and is defined as the science of life and living organisms. An organism is a living entity consisting of one cell e.g. bacteria, or several cells e.g. animals, plants and fungi.

Hope it helps

Explanation:

5 0
3 years ago
Read 2 more answers
Please help me, I'll give you 15 points.
babunello [35]
Yep same, i don’t know what to write abt it is jus saying what to write and now what abt
4 0
3 years ago
What do the letters of the su command stand for? what can you do with su besides give yourself root privileges? "what can you do
Viefleur [7K]
Super User.
Execute commands that require root privileges.
Log in as the root user, then type 'passwd user'<span>
</span>
4 0
4 years ago
You can initialize more than one variable in a for loop by placing a(n) ____ between the separate statements.
Wittaler [7]
Comma





-------------------------------------------------
5 0
3 years ago
Other questions:
  • Candace opened an email from a person she didn't know and clicked on a pop-up in the email that installed a virus on her compute
    8·2 answers
  • Define the term e-learning​
    5·2 answers
  • is a shell program in Windows that holds individual utilities called snap-ins, designed for administration and troubleshooting.
    11·1 answer
  • Explain how devices on a lan access resources in a small to medium-sized business network.
    15·1 answer
  • What is the deck of a suspension bridge called​
    15·1 answer
  • Luis saves an attachment that he received from Kevin. Where will the attachment save by default?
    5·1 answer
  • Which type of data storage allows computers to read and write to the memory while the computer is powered on?
    15·1 answer
  • A classic game, Wario Land, has an invincible main character who reacts to the environment in order to solve puzzles. So, for ex
    11·1 answer
  • what are some steps Hector could have taken to ensure that his photographs were not ruined near the end of the shoot?
    12·1 answer
  • Why do we need to use a VPN service?
    9·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!