Thanks for the advice guys.
I've amended my code so that values that will be used by multiple methods are class variables and any other variable is local to a particular method.
Type: Posts; User: IanSawyer
Thanks for the advice guys.
I've amended my code so that values that will be used by multiple methods are class variables and any other variable is local to a particular method.
I've fixed it!
A couple of lines of code needed rearranging between methods!
Thanks for your help, I'm sure that I wasn't entirely clear with my problems!
The data that the program uses is input by the user through a command prompt window. The correct values of year, month and day are being printed.
I have also now narrowed down the issue being...
Even with hardcoded values, 0 is returned for lastDayOfMonth.
I rewrote part of the code just for testing and put it into a single class and it all works fine. lastDayOfMonth returns the correct...
Main class
import java.util.*;
import java.text.*;
import javax.swing.*;
public class MainClass {
public static void main(String[]args){
I have narrowed down the problem to the lastDayOfMonth = date.getActualMaximum(GregorianCalendar.DAY_OF_MONTH); line.
For some reason that line returns 0 for any form of date when ran in the...
Sorry I don't understand where I am supposed to add the println statements.
And how would the discount=true; executed?
The boolean isn't being set as true which is the issue.
Any dates that I input which should meet the criteria of the if statement don't set the boolean to true. It stays false.
Hi guys,
I am having an issue with some Java that I have written.
I have a class called Journey and within this class I have some methods. In my code I have a boolean data member set as false...