Java program for input of numbers only

Assignment Help JAVA Programming
Reference no: EM13941967

Edit Java program for input of numbers only. If the user inputs a letter the program must abort with a messegae like "Program aborted by user". Please explain the code.

import java.util.*;

public class NumberMonth

{
public static void main(String args[])

{
Scanner input = new Scanner(System.in);

while (true)

{
System.out.println("Please enter month number 1-12 to get month name (to quit press any letter': ");

int month = input.nextInt();

switch (month)

{
case 1: System.out.println("January"); break;

case 2: System.out.println("February"); break;

case 3: System.out.println("March"); break;

case 4: System.out.println("April"); break;

case 5: System.out.println("May"); break;

case 6: System.out.println("June"); break;

case 7: System.out.println("July"); break;

case 8: System.out.println("August"); break;

case 9: System.out.println("September"); break;

case 10: System.out.println("October"); break;

case 11: System.out.println("November"); break;

case 12: System.out.println("December"); break;

default: System.out.println("Wrong Input!!!");

}

}

}

}

Reference no: EM13941967

Questions Cloud

Discuss the potential influences of power : Write a summary in which you critically discuss the potential influences of power and politics that can affect your scenario organisation. Explain the issues of power and politics that may arise within and across teams as a consequence of the pend..
Analyzing the leadership of a 21st century : Using relevant theories and models critically evaluate and analyse the leadership of a 21st century business leader (must be an Australian or American leader).
Find the maximum loss and the break-even point : Assume you sell a European call option on AUD100,000 (AUD = Australian Dollar). The strike price is X(USD/AUD)=0.72 (USD = U.S. Dollar), the maturity is one year, and the premium is 5 cents per AUD. Find the maximum loss and the break-even point S(US..
Determine share price needed on expiry to obtain profit : At time 0, the share price of a stock was $85. At that time, a call option on a share of stock with a strike price of $95 expiring 6 months later had a premium $2.00. Risk free interest is 4% annual effective. Determine the payoff and the profit on t..
Java program for input of numbers only : Edit Java program for input of numbers only. If the user inputs a letter the program must abort with a messegae like "Program aborted by user". Please explain the code.
Expected to provide after-tax operating cash flows : What is the IRR for the following project if its initial after tax cost is $5,000,000 and it is expected to provide after-tax operating cash flows of ($1,800,000) in year 1, $2,900,000 in year 2, $2,700,000 in year 3 and $2,300,000 in year 4?
What appears on the screen when you place mouse pointer text : What appears on the screen when you place the mouse pointer under text that was corrected by AutoCorrect? Which button do you click to show formatting marks in a document? The first time you save a document, which dialog box appears? What happens whe..
Calculate the rate at which radiation is incident : Calculate the rate at which radiation is incident on A3 due to emission and reflection from A1.
Organizations are using cloud computing : A growing number of organizations are using cloud computing as a viable alternative for their IT resource needs. Cloud computing allows organizations to increase their ability to meet computing resource demands while avoiding significant investments ..

Reviews

Write a Review

JAVA Programming Questions & Answers

  Describe how an eavesdropped can gain access

Describe how an eavesdropped can gain access to the remote server with a relatively modest number of guesses ( Hint:  The eavesdropped starts guessing after the original user has typed all but one character of the password.

  Application that calculates and displays the total payable

Write a java application that calculates and displays the total payable after applying discount on online grocery orders for N customers. The N should be set as a constant (final) in your application and choose a value between 7 and 9.

  Application that accesses and implements a merchant database

iam providing the old Java application files that implement the old Merchant_Database.txt (i.e., Merchant.java, LinkedMap.java, MerchantDatabase.java, Merchant_Database.txt) that allows merchant records to be added, removed, looked up and the resu..

  Implementation of the vector data type

Described in general terms the implementation of the vector data type. Complete the implementation of the vector by providing definitions for the subsequent operations

  Design the appropriate accessor and mutator methods

Design an Employee class that has fields for the following pieces of information: Employee Name Employee Number Next, design a class named ProductionWorker that extends the Employee class.

  1 linked listsin this problem you will write a class that

1 linked listsin this problem you will write a class that implements an ordered list of strings. your class will able

  What are the diagrams defined in the uml standard

What are the diagrams defined in the UML Standard. Give a one or two sentence description of each one. Given the following code, how should the toString methods in the classes H2ClassA and H2ClassB be written to give the indicated output and take a..

  Create a console-based application named multiplication

Create a console-based application named Multiplication whose main() method asks the user to input and then calls a method named MultiplicationTable(), which displays the results of multiplying the integers by each of the number 2 through 10

  Write an applet that simulates a soft drink machine.

Write an applet that simulates a soft drink machine. The simulated machine dispenses the following soft drinks: cola, lemon-lime soda, grape soda, root beer, and bottled water. These drinks cost $0.75 each to purchase.

  Implement a shopping cart class with user interface

project will be to implement a shopping cart class with user interface (UI) that contains main() in Net Beans. The UI class will be used to perform user input/output and to invoke the appropriate methods of shopping cart class. When your program star..

  Create an interface called player

Create an interface called Player. The interface has an abstract method called play() that shows a message describing the meaning of "play" to the class.

  Write, compile and run a standalone java application

Write, compile and run a standalone Java application that displays an output line on the console.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd