Java Program - Can you help do this i have no idea

Feb 6th, 2013
RockCafe
Category:
Other
Price: $10 USD

Question description

here is the brief i have been given

BirthMonth analysis

What data is used in program?

monthTally: integer array containing number of births per month, incremented in program

monthNum: integer month input by user

monthNames: String array of month names initialised in program

largestLocation: integer location of largest value, calculated by program

What operations are performed?

iteration needed to input all data

nested selection needed to validate month number

iteration needed to output all data

iteration needed to find most popular month

nested selection to check if month is the largest

What operations are done once before the loop to read months?

create Scanner

prompt user for birth month

input birth month

How many times is loop to read months repeated?

  • loop repeated while monthNum not -1

What operations are repeated inside loop to read months?

  • output error message if monthNum not valid
  • increment tally for specified month if valid
  • input birth month

What operations are done once between loop to read months and loop to output months?

none

How many times is loop to output months repeated?

  • loop repeated for each element in table, i = 0 to length of array

What operations are repeated inside loop to output months?

  • convert month number to name and output it
  • output monthTally[i]

What operations are done once between loop to output months and loop to find most frequent month?

initialise largestLocation to 0

How many times is loop to find most frequent month repeated?

  • loop repeated for each element in table apart from first, i = 1 to length of array

What operations are repeated inside the loop to find most frequent month?

  • if contents of location i greater than location largestLocation store i in largestLocation

What operations are done once after loop to find most frequent month?

  • convert largestLocation month number to name and output it

Implementation

Method to input months

  • method name: inputMonths
  • method parameters: monthTally integer array containing number of births per month
  • method returns: nothing
  • method body: loop to input and validate months

Method to output months

  • method name: outputMonths
  • method parameters: monthTally integer array containing number of births per month
  • method returns: nothing
  • method body: loop to output month names and values

Method to find most frequent month

  • method name: findMost
  • method parameters: monthTally integer array containing number of births per month
  • method returns: int – location of month with highest value
  • method body: loop to find largest value and return it

Method to output name of month

  • method name: toString
  • method parameters: num – integer of month to output name for
  • method returns: String – name of month
  • method body: return string corresponding to required month

 

any ideas

Tutor Answer

(Top Tutor) Daniel C.
(997)
School: UC Berkeley
PREMIUM TUTOR

Studypool has helped 1,244,100 students

3 Reviews


Summary
Quality
Communication
On Time
Value
BlueOcean
Nov 11th, 2016
" Awesome! Exactly what I wanted. "
ashleyisgod
Oct 19th, 2016
" Top quality work from this guy! I'll be back! "
Molly_Moon
Sep 27th, 2016
" AMAZING as always! "
Ask your homework questions. Receive quality answers!

Type your question here (or upload an image)

1829 tutors are online

Brown University





1271 Tutors

California Institute of Technology




2131 Tutors

Carnegie Mellon University




982 Tutors

Columbia University





1256 Tutors

Dartmouth University





2113 Tutors

Emory University





2279 Tutors

Harvard University





599 Tutors

Massachusetts Institute of Technology



2319 Tutors

New York University





1645 Tutors

Notre Dam University





1911 Tutors

Oklahoma University





2122 Tutors

Pennsylvania State University





932 Tutors

Princeton University





1211 Tutors

Stanford University





983 Tutors

University of California





1282 Tutors

Oxford University





123 Tutors

Yale University





2325 Tutors