Question
Its been a long time since I took Java 111 and 111b. I'm unsure how to make this program could you please help. I need
Its been a long time since I took Java 111 and 111b. I'm unsure how to make this program could you please help. I need to Create a java program that identifies all palindromic dates in a given year. First a user enters a year. Then the program reports the palindromic dates. Finally, the program asks the user if he or she wishes to try again. Note that you need a class similar to the Palindrome class, but one that permits testing "digit" characters. This is the palindrome program that comes with the chapter.
//--------------------------------------------------------------------- // Palindrome.java by Dale/Joyce/Weems Chapter 4 // // Provides a method to test whether a string is a palindrome. // Non letters are skipped. //--------------------------------------------------------------------- package ch04.palindromes; import ch02.stacks.*; import ch04.queues.*; public class Palindrome { public static boolean test(String candidate) // Returns true if candidate is a palindrome, false otherwise. { char ch; // current candidate character being processed int length; // length of candidate string char fromStack; // current character popped from stack char fromQueue; // current character dequeued from queue boolean stillPalindrome; // true if string might still be a palindrome StackInterface stack; // holds non blank string characters QueueInterface queue; // also holds non blank string characters // initialize variables and structures length = candidate.length(); stack = new ArrayBoundedStack(length); queue = new ArrayBoundedQueue(length); // obtain and handle characters for (int i = 0; i < length; i++) { ch = candidate.charAt(i); if (Character.isLetter(ch)) { ch = Character.toLowerCase(ch); stack.push(ch); queue.enqueue(ch); } } // determine if palindrome stillPalindrome = true; while (stillPalindrome && !stack.isEmpty()) { fromStack = stack.top(); stack.pop(); fromQueue = queue.dequeue(); if (fromStack != fromQueue) stillPalindrome = false; } // return result return stillPalindrome; } }
You can modify this code but it must use the authors Queue and Stack code not Java's. You must make sure that the user enters a VALID date (months are 1 to 12, days are 1-31.. don't worry about different months having different amounts of days, and years can't be negative but we will define them as from 1000 - 9999). This is from Object oriented data structures using Java 4th. chapter 4 #29
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