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
For a Windows laptop, what is the best way to save power when the computer will not be used for an extended period?
Natali5045456 [20]

Move the mouse under the bar at the top of the window and hold with the hand button keep holding the button and drag it across the screen.

5 0
3 years ago
Read 2 more answers
When a cells number format is “time” it will show a value in what format
Leokris [45]

The format of time shows a value of time day (what time it is).

When you choose the option of time you can have it displayed in a variety of formats, including military time and a time display that will change with regional time zones,

3 0
3 years ago
The physical layer of the OSI model is not foundational to any of the other layers. True or False
galina1969 [7]

Answer:

False.

Explanation:

OSI model stands for Open Systems Interconnection. The seven layers of OSI model architecture starts from the Hardware Layers (Layers in Hardware Systems) to Software Layers (Layers in Software Systems) and includes the following;

1. Physical Layer

2. Data link Layer

3. Network Layer

4. Transport Layer

5. Session Layer

6. Presentation Layer

7. Application Layer

Each layer has its unique functionality which is responsible for the proper functioning of the communication services.

The physical layer of the OSI model is the first layer of the OSI model and it is foundational to any of the other layers because it determines the means of transmitting (sending) raw bits from one network node to another and the electrical specification of network equipments.

5 0
3 years ago
What are at least three differences between a personal and non-personal blog?
qwelly [4]
The difference betweeen personal and nonpersonal blogs are that on a personal blog you give out most information you dont want people to know or it is anonomys 
4 0
3 years ago
Genres are useful for many reaseons. What are some explanations you can think of for how genres can be useful to players, game d
elena-14-01-66 [18.8K]
  • Genres are used in Readers as well as writers.
  • By using genre patterns in writers it has been accepted by readers for accomplishing their purposes.
  • Genres allow both writers and readers to establish a working relationship between each other.
  • Both writers and readers are required for gamers and game publishers.
  • So Genres are very useful to them.
7 0
3 years ago
Other questions:
  • Social scientists who study criminal behavior.
    7·2 answers
  • What is the first step in the exchange between a web browser and a database?
    7·1 answer
  • What engine component is shown in the above Figure?
    14·2 answers
  • Moore’s Law is said to be more of a trend, rather than a representation of the actual number of transistors on a silicon chip. W
    14·1 answer
  • How do you make an app for help
    6·2 answers
  • How can I collect tweets from different accounts concurrently and categorize the tweets in a corpus?
    15·1 answer
  • Write the method addItemToStock to add an item into the grocery stock array. The method will: • Insert the item with itemName ad
    12·1 answer
  • Redundancy can be implemented at a number of points throughout the security architecture, such as in ________. Group of answer c
    12·1 answer
  • How can using Prezi software for a presentation allow the presenter to better respond to audience needs?
    10·1 answer
  • Revisa un manual o instructivo de las maquinas o aparatos tecnologicos que tengas en tu casa. Luego, trata de encontrar algunas
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!