Logic and Design

Cynthia
Logic and Design
3 Answer(s)      5 years and 9 months ago
Posted in : Design concepts & design patterns

Please help me with this Write a program that prompts and accepts a number between 1 and 12. After getting the input, display the number with the appropriate month. (example: This is the 1st monthÂ¦January, This is the 2nd monthÂ¦February, This is the 12th monthÂ¦December).

Thanks

January 23, 2012 at 5:47 PM

```import java.text.*;
import java.util.*;

class PrintMonth
{
public static String getMonthForInt(int m) {
String month = "invalid";
DateFormatSymbols dfs = new DateFormatSymbols();
String[] months = dfs.getMonths();
if (m >= 0 && m <= 11 ) {
month = months[m];
}
return month;
}
public static void main(String[] args)
{
Scanner input=new Scanner(System.in);
System.out.print("Enter number between 1 and 12: ");
int num=input.nextInt()-1;
System.out.println("Month is: "+getMonthForInt(num));
}
}
```

January 23, 2012 at 6:22 PM

```	//please reply if my post really helps
import java.io.*;
class Month
{
public static void main()throws IOException
{
System.out.println("Enter number between 1 and 12: ");
String mn[]={January,February,March,April,May,June,July,August,September,Octobr,November,December};
if(num==1)
System.out.println(num+"st month "+mn[num-1];
else if(num==2)
System.out.println(num+"nd month "+mn[num-1];
else if(i==3)
System.out.println(num+"rd month "+mn[num-1];
else
System.out.println(num+"th month "+mn[num-1];
}
}

```

January 23, 2012 at 6:24 PM

//copy the previous code in notepad and run in bluej

Logic and Design
Logic and Design  Please help me with this Write a program that prompts and accepts a number between 1 and 12. After getting the input, display the number with the appropriate month. (example: This is the 1st monthÂ¦January
LOGIC
LOGIC  hey guys..i have my exams coming in somedays and it would be really helpful if someone explained how to develop the logic of any program
LOGIC
LOGIC  hey guys..i have my exams coming in somedays and it would be really helpful if someone explained how to develop the logic of any program
Logic and desgin
Logic and desgin  How would this be put in visual logic symbol
Logic and Degin
Logic and Degin  Need help in writing a pseudocode for this can so please help me with this just need to get started. In this lab, you are going... will modify the existing code to create a modularized design. Load the array via
Logic Building
Logic Building  I wanted to devlop my logic ? How can i do so ? Can i start with java or i need to do c++ before
Logic Iterate.
Logic Iterate.  I have one doubt about logic:iterate. I use text feild inside of logic:iterate , there is possible will generate N no of rows (text feild) inside of iterate. my doubt is how to get the Paritcular rows text
Logic Iterate.
Logic Iterate.  logic iterate Struts I have one doubt about logic:iterate. I use text field inside of logic:iterate , there is possible... the Particular rows text value. for example: print("<logic:iterate id="xid
Business logic vs Presentation logic - JSP-Servlet
Business logic vs Presentation logic  what is the difference between Business logic and Presentation logic
logic-iterate
logic-iterate  in my code i am using for-each loop for displaying data i want use tag to display data how to use plase help me <%@ page import="java.sql.*" %> <%String[] id = (String[])session.getAttribute("ids
What is programming logic ?
What is programming logic ?  What is programming logic
WEB LOGIC - JSP-Servlet
WEB LOGIC project  I want the procedure to run a project in we logic server
the business logic is executed.  In which method of Action class the business logic is executed
what is the logic of this pattern?
what is the logic of this pattern?   1 121 12321 1234321
struts logic tags
struts logic tags  what is the use of struts logic tag   The purpose of Struts logic tags is to alter output depending on the given...://www.roseindia.net/struts/struts-logictags/logic-tags-introduction.shtml http
Version of com.thesett>logic dependency
List of Version of com.thesett>logic dependency
the Web-Logic with Tomcat 5.0 version in Console. Somebody has suggested to see the webpage (they had given the link).But when i installed the Web-Logic i... folder in the Web-Logic
Struts logic iterate
Struts logic iterate  This is my jsp page in which i used 3 logic...; <%@taglib uri="http://struts.apache.org/tags-logic" prefix="logic"%>...; <body> <h1> Search </h1> <logic:iterate name
logic for pattern program
logic for pattern program  what's the logic for create pattern program how can i create any pattern program with in minute. like this 123454321... create this program in java without help whats the logic how can i understand
logic iterate tag - Struts
logic iterate tag  Hey I am displaying the values in a jsp called categoryView.jsp using logic iterate tag as Now properties bname and quant belongs to another formbean named as ViewCategoryForm.java.When I
logic for c language
logic for c language  01 02 03 04 05 06 20 21 22 23 24 07 19 32 33 34 25 08 18 31 36 35 26 09 17 30 29 28 27 10 16 15 14 13 12 11
Business Logic in mvc2 - JSP-Servlet
Business Logic in mvc2  What is business logic and where it is written using servlet and jsp
java design
java design  What is design by contract
Design pattern
Design pattern  explain factory pattern
Tell us the logic of diceroller
Tell us the logic of diceroller  import java.io.*; import javax.servlet.*; import javax.servlet.http.*; public class DiceRollerServlet extends... is " +dice2); } } dice1 =3 dice2 =2 How is the logic executed????
Please explain the logic....  class A1 { } class B extends A1 { } public class ComingThru { static String s = "-"; public static void main(String[] args) { A1[] aa = new A1[2]; B[] ba = new B[2
ATM Logic - Java Beginners
ATM Logic   Q-In an ATM program i want to print the receipt in which there is information of rupees note that come out from an ATM machine when user enters the particular amount. For e.g. if user enters 2250 then he should get
J2EE design patterns - Design concepts & design patterns
J2EE design patterns  Hi all, could any one send me design patterns links. its very utgent. thanks, lakshminarayana.  Hi Friend, For J2EE Singleton Pattern,visit the following link: http
java - Design concepts & design patterns
java  give the code to design the hotel management software
struts logic:iterate tag
struts logic:iterate tag  Hi All, I am writing a look up jsp which is using logc:iterate every thing is fine except this the problem here is unable to go inside the tag. Here is the stack trace I am getting. [#|2010-10-27T00
Version of struts>struts-logic dependency
List of Version of struts>struts-logic dependency