Question: Topics: (nested-if, switch-case): NO loops or User input/Scanner class is allowed for this homework Program #1: Write a program which will use an input value

Topics: (nested-if, switch-case): NO loops or User input/Scanner class is allowed for this homework
Program #1: Write a program which will use an input value that is assigned by you i.e Int One = 1 etc. 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. Program #2: Convert Program #1 into using some sort of switch-case statement this program should be name PrintNumberToWordie2 Hints: * Trying nested-if and switch-case statements. *7 public class PrintNumberinWord{ // Save as "PrintNumberToWordie.java" public static void main(String[] args) { int number = 5; // Set the value of "number" here! // Using nested-if if (number == 1) { System.out.println(...); } else if (.....) { } else if (.....) { } else {
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
