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 which base class members may not be inherited

Without considering the access attributes, list and describe which base class members may not be inherited by a derived class and provide a rationale for why this is.

  This project mainly focuses on explaining your

this project focuses on demonstrating your understanding of java collections. before attempting this project be sure

  Java program asks the user to input the number of gallons

Write a java program asks the user to input the number of gallons of gas in the tank and the price of gas per gallon

  Design a solution to the problem by using the five steps to

the software needs to allow the restaurant owner to schedule employees for up to 40 hours in a seven-day week. the

  Translates a number into the closest letter grade

Write a program that translates a number into the closest letter grade. For case, the number 2.8 which might have been the average of several grades would be converted to B-

  Create classes implement java interface

Interface that contains a generic type. Create two classes that implement this interface.

  Create a console program that prompts the user

Create a console program that prompts the user to enter the name and address of their employer and position they hold or the name and address of their favorite restaurant and their favorite meal

  Create a user interface for a library application

Create a user interface for a library application that allows the user (i.e., the Librarian) to enter Book objects.

  Provide java code for a method

Provide Java code for a method that would perform functionality of your choice. Try to create functionality that is unique - something that you could use. Be sure to include an example call to your method and explain the code you developed.

  Returns the object with the largest measure

public static Measurable maximum(Measurable[] objects)that returns the object with the largest measure. Use that method to determine the country with the largest area from an array of

  Program that allows two players to play tic-tac-toe

Implement a program that allows two players to play tic-tac-toe. Draw the game grid and an indication of whose turn it is (X or O). Upon the next click, check that the mouse click falls into an empty location,

  Write a program in java that uses a method called quadrant

JAVA) write a program IN JAVA that uses a method called quadrant that accepts as parameters a pair of double values representing an (x, y) point and returns the quadrant number for that point. Recall that quadrants are numbered as integers from 1 to ..

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