I have the following error on line 71 and I'm not sure whats wrong with that statment any explanation would be greatly appreciated.

C:\Users\peter\Desktop\CSC 111\welch_lab4\welch_lab4.java:71: cannot find symbol
symbol : method equalsIgnorCase(java.lang.String)
location: class java.lang.String
while (!(response.equalsIgnorCase(FLAG)))
^
1 error

Tool completed with exit code 1

This is the details of what i am working on if something is not clear in the code.

Write two programs.

The first program will create a new file and place the following information in it:

1. Name
2. ID number
3. GPA

The second program will open this file and display the information for each person on a separate line as follows:

Name, ID number, GPA

Please separate each field with commas when you print it out.

//Prologue Section
/**********************************************************************
* Program Name:   CSC 111 lab 4
* Author:    Peter Welch
* Date:     April 11, 2011
* Course/Section:  CSC 111-001 (002w)
*  Program Description:
*  Program will create a new file and place the following information in it.
*     1.	Name
*     2.	ID Number
*     3.	GPA
*Initial Algorithm:
*
* BEGIN lab 4
*
*
*
*
* END lab 4
*********************************************************************/

	 //Pre-Processor Declaration Section

	 import java.io.*;



	 public class welch_lab4
	 {// START CLASS LAB 4


		public static void main (String args[])

		{// BEGIN MAIN METHOD CREATE NEW FILE




		final String FLAG = "N"; // EXIT SENTINEL

		String outLine = ""; // USED TO MAKE OUTPUT LINE

		String outPutFile; // NEW FILE NAME

		String response = "Y"; // USER EXIT INDICATOR

		String name;

		int IDnumber;

		double GPA;



		try
		{ // GET FILE NAME

		System.out.println("Please Enter Desired file name.");
		outPutFile=Keyboard.readString();

		//OPEN THE OUTPUT STREAM



		FileWriter fileWrite = new FileWriter(outPutFile);
		BufferedWriter buffWrite= new BufferedWriter(fileWrite);
		PrintWriter outFile = new PrintWriter(buffWrite);


		//GET DATA
		while (!(response.equalsIgnorCase(FLAG)))
		{
			// GET NAME IDNUMBER AND GPA

				System.out.println("Please enter a name.");
			  	name=Keyboard.readString();

				System.out.println("Please  enter an IDNumber.");
				IDnumber= Keyboard.readInt();

				System.out.println("Please enter a GPA.");
				GPA=Keyboard.readDouble();

				// CREATE OUTPUT LINE (NAME, IDNUMBER, GPA)

				outLine = outLine+name+", "+IDnumber+", "+GPA;

				// WRITE LINE TO FILE

				outFile.print(outLine);
				outFile.println();

				// EMEPTY STRING FOR NEXT LINE
				 outLine = "";

				 System.out.println("Do you wish to enter more data? Y/N");
				 response=Keyboard.readString();

			 } // END WHILE RESPONSE

			 //FLUSH AND CLOSE THE OUTPUT FILE
			 buffWrite.flush();
			 buffWrite.close();

		 } // END TRY

		 catch(IOException exception)
		 {//START CATCH
			 System.out.println(exception.getMessage());
		 }// END CATCH

			}//END MAIN

		}// END CLASS

Recommended Answers

All 2 Replies

while (!(response.equalsIgnorCase(FLAG)))

Read that very, very carefully.


Maybe this will help:

while (!(response.equals Ignor Case (FLAG)))

See it now?

Thanks look at something 1000 times and your eyes play tricks on you

Solved!

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.