Arrays

Design a flow chart for program that displays the number of days in each month. the program should have two parllel arrays 12 element string array that is initialized with the names of the month, and 12 element integer array that is initialized the number of days in each month.

Questions by pokhara

Showing Answers 1 - 2 of 2 Answers

Ponni Vaithiyanathan

  • Aug 20th, 2013
 

Jan Month have 31 Days
feb Month have 28 Days
March Month have 31 Days
April Month have 30 Days
May Month have 31 Days
June Month have 30 Days
july Month have 31 Days
Aug Month have 30 Days
sep Month have 31 Days
oct Month have 30 Days
nov Month have 31 Days
dec Month have 30 Days

Code
  1. public class arrayTest {

  2.  

  3.         public static void main(String args[]) {

  4.  

  5.                 String[] aryOfMonth = new String[] { "Jan", "feb", "March", "April",

  6.                                 "May", "June", "july", "Aug", "sep", "oct", "nov", "dec" };

  7.                 int[] noOfDaysInMonth = new int[] { 31, 28, 31, 30, 31, 30, 31, 30, 31,

  8.                                 30, 31, 30 };

  9.  

  10.                 for (int i = 0; i < aryOfMonth.length; i++) {

  11.  

  12.                         System.out.println(aryOfMonth[i] + " Month have "

  13.                                         + noOfDaysInMonth[i] + " Days");

  14.                 }

  15.  

  16.         }

  17. }

  18.  

  Was this answer useful?  Yes

Cassandra Blackburn

  • Sep 9th, 2013
 

Jan Month have 31 Days Feb Month have 28 days March Month have 31 Days April Month have 30 Days
May Month have 31 days June Month have 30 Days July Month have 31 days Aug Month have 31 Days
Sept Month have 30 Days Oct Month have 31 Days Nov Month have 30 days Dec Month have 31 Days

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions