Question
Develop your program according the pseudo code given in class. of 3 -ZOOM + 1. Copy instructors JulianDate class from CSUSs Canvas into your working
import java.util.Calendar;
public class PrintCalendar { private int year; //private final JulianDate jd = new JulianDate(); int printMonth; public static void main (String[] args) { int inputYear; //check program if an argument is passed from the command line if(args.length==0) { //if no argument is passed, then default the current year inputYear = Calendar.getInstance().get(Calendar.YEAR); } else { //if an argument is being passed, parse the string to an //integer and store as Input inputYear = Integer.parseInt(args[0]);; } //instantiate a new PrintCalendar object PrintCalendar myCal = new PrintCalendar (inputYear); //print the calendar myCal.printCal (); } //}
public PrintCalendar(int inputYear) { this.year = inputYear; } public void printCal() { //label the year System.out.printf(\"%13s \", this.year); //repeat 12 times to print a month for(int month = 1; month => { printMonth(month); } } //second method read a year //print the calendar of the year //label the calendar of the year //prints months
public void printMonth(int month) { //labe the input of month //labe days of the week System.out.println(\" Sun Mon Tue Wed Thu Fri Sat\"); //prints days numbers 1 2 3 .. }
//third refinement //read a year //print the calendar of the year //label the year //repeat 12 times //print a month
public static boolean determineLeapYear(int year) { if((year % 400 = 0) || ((year % 4 == 0) && (year % 100 !=0))) { return true; } return false; }
//label the month //label days of the week //print days
public void printDayOfWeek () { System.out.println(\" Sun Mon Tue Wed Thu Fri Sat\"); }
//fifth //deterine number of days //position the 1st day //print days
public void printDayNumbers (int month) { }
//sixth //print a day public void getNumberOfDay (int month) { //switch statement that uses the month number to return the day switch (month) { case 1: System.out.printf(\" %15s \", \"January\"); numberOfDay = 31; break; //february sometimes has 28 or 29 days case 3: System.out.rintf(\" %15s \", \"March\"); numberOfDay = 31; break; case 4: System.out.printf(\" %15s \", \"April\"); numberOfDay = 30; break; case 5: System.out.printf(\" %15s \", \"May\"); numberOfDay = 31; break; case 6: System.out.printf(\" %15s \", \"June\"); numberOfDay = 30; break; case 7: System.out.printf(\" %15s \", \"July\"); numberOfDay = 31; break; case 8: System.out.printf(\" %15s \", \"August\"); numberOfDay = 31; break; case 9: System.out.printf(\" %15s \", \"September\"); numberOfDay = 30; break; case 10: System.out.printf(\" %15s \", \"October\"); numberOfDay = 31; break; case 11: System.out.prntf(\" %15s \", \"November\"); numberOfDay = 30; break; case 12: System.out.printf(\" %15s \", \"December\"); numberOfDay = 31; break; } this.printDayOfWeek(); this.printDayNumbers(month); return numberOfDay; } private int getFebruaryDays() { if ((year % 400 == 0) || ((year % 4 == 0) && (year % 100 != 0))) { return 29; } return 28; } } Above I have included what I have so far and I will include the Julian class as well.
public class JulianDate { public static int JGREG = 588829;
public static int toJulian(int n, int n2, int n3) { int n4 = n; if (n ++n4; } int n5 = n2; if (n2 > 2) { ++n5; } else { --n4; n5 += 13; } double d = Math.floor(365.25 * (double)n4) + Math.floor(30.6001 * (double)n5) + (double)n3 + 1720995.0; if (n3 + 31 * (n2 + 12 * n) >= JGREG) { int n6 = (int)(0.01 * (double)n4); d += (double)(2 - n6) + 0.25 * (double)n6; } return (int)Math.floor(d); } }
I need help with my program. I am trying to print the Calendar and it wont print.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started