I had thought I was finally done with this program, it finally ran but then realized that it wasn't doing the right thing mean LOGIC error :(
Can someone plz help me correct this error I have been messing around with it but keep running across errors


Here is the original MAIN:

import java.util.Scanner;
public class Birthdate
{
	public static void main (String[] args)
	{
		Profile p= new Profile();
		Profile oldestStudent = new Profile(1999,12, 31);
		Profile base = new Profile (02, 29);

		p.readData();
		while (!(p.studentId.equals("000")))
		{
			if (Profile.dataValid(p))
			{
				Profile.totalStudents();
				if (base.ckBirthDate(p))
					p.updateBirthDateTotal();
				if (base.ckOldestBirthDate(p,oldestStudent))
					oldestStudent.updateBirthDateTotal();
				p.formatMonth();
				Profile.writeStudentData(p);
				p.readData();
			}
		}


		System.out.println(p.getStudentId());
		System.out.println(p.getBirthDateDay());
		System.out.println(p.getBirthDateMonth());
		System.out.println(p.getBirthDateYear());
		Profile.writeOutcome(p);
	}
}

I changed this portion, hoping it would fix the problem:

while (!(p.studentId.equals("000")))
	{
		if (Profile.dataValid(p))
		{
			Profile.totalStudents();
			if (base.ckBirthDate(p))
				p.updateBirthDateTotal();
			if (oldestStudent.ckOldestBirthDate(p,oldestStudent))
				p.updateBirthDate(student);
			p.formatMonth();
			Profile.writeStudentData(p);
			p.readData();			

		}
             }

but i ended up with these errors:

ckOldestBirthDate(Profile,Profile) in Profile cannot be applied to (Profile)
if (oldestStudent.ckOldestBirthDate(p))


updateOldestBirthDate(Profile,Profile) in Profile cannot be applied to ()
p.updateOldestBirthDate();


here's the pseudocode for that portion:

DOWHILE studentId =/= '000'
     Validate data (method)
     IF valid data = true THEN
              countStudents(method)
              IF ckBirthDate(method) THEN
                        updateBirthDate (method)
              ENDIF
              IF ckOldestBirthDate(method) THEN
                        updateOldestBirthDate(method)
              ENDIF
     ENDIF

can someone please help me, i have been struggling with this program over a week now..getting really frustrated. Please help me. what am I doing wrong?? :(
Let me know if you need me to provide you more information (fyi this is a little urgent :( )

Recommended Answers

All 2 Replies

Sorry, nevermind I solved the problem after an hour (just when I was about to give up)

Anyway could someone please delete this thread?

Threads are never deleted for database reasons. It would also help if, in the future, you mark threads solved once you are done with them, and post what you did to fix the code, that way people don't come in with the intention of helping you solve your problem and find out that you don't need help after they already read posts.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.