Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Been trying to write this program, and have been having errors all over the plac

ID: 3654710 • Letter: B

Question

Been trying to write this program, and have been having errors all over the place. Any help is appreciated. I was going to post the code I have but it was messy, and uncomprehending. Thanks in advance. ============================================================================== Problem description: Write a program that asks the user to input a date in the form of mm/dd/yyyy, and then prints the English word for Month and Day (keep Year as a four-digit number): Enter a date as mm/dd/yyyy: 05/21/2012 The day is: May the twenty first 2012. Hints: 1. Put / between %d

Explanation / Answer

package Cramster; import java.util.Scanner; public class Date { private int month; private int day; private int year; private static final int[] daysPerMonth = {0,31,28,31,30 ,31,30,31,31,30,31,30,31}; private static final String[] monthName = {"No name","January" ,"February","March","April","May","June","July","August", "September","October","November","December"}; private static final String[] dayName = {"","First","Second","Third","Fourth","Fifth", "Sixth","Eigth","Ninth","Tenth","Eleventh","Twelve","Thirteen","Fourteen","Fifteen", "Sixteen","Seventeen","Eighteen","Nineteen","Twenty", "Twenty First", "Twenty Second", "Twenty Third", "Twenty Fourth", "Twenty Fifth", "Twenty Sixth", "Twenty Seventh", "Twenty Eigth","Twenty Ninth","Thirty","Thirty Forst"}; public Date(String date ) throws Exception { String[] tokens = date.split("/"); if(tokens.length != 3) throw new Exception("Your Input is not in correct format"); this.month = checkMonth(Integer.parseInt(tokens[0])); this.year = checkYear(Integer.parseInt(tokens[2])); this.day = checkDay(Integer.parseInt(tokens[1])); } public int checkMonth(int month) { if(month > 0 && month =0) return year; else throw new IllegalArgumentException("Year must be greater than 0"); } public int checkDay(int day) { if(day>0 && day
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote