Question

Why am I getting this error? 3 errors found: File: /Users/FDM/Desktop/ITSC_1212_InitialSetup/ITSC_1212/bookClasses/Assignment3Part2.java [line: 57] Error: <identifier> expected...

Why am I getting this error?

3 errors found:
File: /Users/FDM/Desktop/ITSC_1212_InitialSetup/ITSC_1212/bookClasses/Assignment3Part2.java [line: 57]
Error: <identifier> expected
File: /Users/FDM/Desktop/ITSC_1212_InitialSetup/ITSC_1212/bookClasses/Assignment3Part2.java [line: 57]
Error: <identifier> expected
File: /Users/FDM/Desktop/ITSC_1212_InitialSetup/ITSC_1212/bookClasses/Assignment3Part2.java [line: 59]
Error: class, interface, or enum expected

public class Assignment3Part2
{
//
public static void main(String [] args) throws InterruptedException
{
String filename;
if (args.length > 0) {
// got a filename passed into program as a parameter
// don't change this part of the code needed by TA for grading
filename = args[0];
System.out.println("Filename passed in: " + filename);

} else {
// ask user for a picture
filename = FileChooser.pickAFile();
System.out.println("User picked file: " + filename);
}
Picture pic = new Picture(filename); // Picture to modify
//
pic.show(); // Show the original picture
Thread.sleep(1000); // Pause for 1 second. You can pause for less if you like
  
Pixel[] pixelArray = pic.getPixels();
for(int x = 0; x < pic.getWidth(); x++);
{
for (int y = 0; y < pic.getHeight(); y++);
{
int h = pic.getHeight();
if ( y <=(h/3))
{

value = pic.getOrange();
value = (int)(value*1.5);
pic.setOrange(value);
}
if ( y > (h/3)&& y < (2*h/3))
{

value = pic.getWhite();
value = (int)(value*1.5);
pic.setWhite(value);
}
else {

value = pic.getGreen();
value = (int)(value*1.5);
pic.setGreen(value);
}

}

}
}
  
pic.repaint(P);
} // End of main
} // End of Class

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Errors:

1) There is extra } at the end of the program
2) There is no methods like getOrange(), setOrange(), getWhite() etc at Picture class
3) pic.repaint(P); from where does P comes from.

I have corrected ERROR 1, However you need to check if those methods exists

==========================================================
public class Assignment3Part2

{

//

public static void main(String [] args) throws InterruptedException

{

String filename;

if (args.length > 0) {

// got a filename passed into program as a parameter

// don't change this part of the code needed by TA for grading

filename = args[0];

System.out.println("Filename passed in: " + filename);

} else {

// ask user for a picture

filename = FileChooser.pickAFile();

System.out.println("User picked file: " + filename);

}

Picture pic = new Picture(filename); // Picture to modify

//

pic.show(); // Show the original picture

Thread.sleep(1000); // Pause for 1 second. You can pause for less if you like

  

Pixel[] pixelArray = pic.getPixels();

for(int x = 0; x < pic.getWidth(); x++)

{

for (int y = 0; y < pic.getHeight(); y++)

{

int h = pic.getHeight();

if ( y <=(h/3))

{

value = pic.getOrange();

value = (int)(value*1.5);

pic.setOrange(value);

}

if ( y > (h/3)&& y < (2*h/3))

{

value = pic.getWhite();

value = (int)(value*1.5);

pic.setWhite(value);

}

else {

value = pic.getGreen();

value = (int)(value*1.5);

pic.setGreen(value);

}

}

}

}

pic.repaint(P);

}

Thanks, PLEASE COMMENT if there is any concern.

Add a comment
Know the answer?
Add Answer to:
Why am I getting this error? 3 errors found: File: /Users/FDM/Desktop/ITSC_1212_InitialSetup/ITSC_1212/bookClasses/Assignment3Part2.java [line: 57] Error: <identifier> expected...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • JAVA getting the following errors: Project4.java:93: error: ']' expected arr[index] = newVal; // LEAVE THIS HERE....

    JAVA getting the following errors: Project4.java:93: error: ']' expected arr[index] = newVal; // LEAVE THIS HERE. DO NOT REMOVE ^ Project4.java:93: error: ';' expected arr[index] = newVal; // LEAVE THIS HERE. DO NOT REMOVE ^ Project4.java:93: error: <identifier> expected arr[index] = newVal; // LEAVE THIS HERE. DO NOT REMOVE ^ Project4.java:94: error: illegal start of type return true; ^ Project4.java:98: error: class, interface, or enum expected static int bSearch(int[] a, int count, int key) ^ Project4.java:101: error: class, interface, or...

  • I keep getting the compilation error: pass the filename from command line arguement... Can you please...

    I keep getting the compilation error: pass the filename from command line arguement... Can you please tell me what im doing wrong? here is the code: import java.io.File; import java.io.FileNotFoundException; import java.util.Scanner; public class ShipDemo { public static void main(String[] args) { String companyName; int num_ships, total_passengers=0, total_tonnage=0; Ship[] shipInventory; try { if(args.length == 1) { File file = new File(args[0]); Scanner fileScan = new Scanner(file); companyName = fileScan.nextLine(); num_ships = fileScan.nextInt(); shipInventory = new Ship[num_ships]; int n=0; String type,name;...

  • I am currently doing homework for my java class and i am getting an error in...

    I am currently doing homework for my java class and i am getting an error in my code. import java.util.Scanner; import java.util.Random; public class contact {       public static void main(String[] args) {        Random Rand = new Random();        Scanner sc = new Scanner(System.in);        System.out.println("welcome to the contact application");        System.out.println();               int die1;        int die2;        int Total;               String choice = "y";...

  • I need to write a program in java that reads a text file with a list...

    I need to write a program in java that reads a text file with a list of numbers and sorts them from least to greatest. This is the starter file. import java.util.*; import java.io.*; public class Lab3 { static final int INITIAL_CAPACITY = 5; public static void main( String args[] ) throws Exception { // ALWAYS TEST FOR REQUIRED INPUT FILE NAME ON THE COMMAND LINE if (args.length < 1 ) { System.out.println("\nusage: C:\\> java Lab3 L3input.txt\n"); System.exit(0); } //...

  • I am creating a program that will allow users to sign in with a username and...

    I am creating a program that will allow users to sign in with a username and password. Their information is saved in a text file. The information in the text file is saved as such: Username Password I have created a method that will take the text file and convert into an array list. Once the username and password is found, it will be removed from the arraylist and will give the user an opportunity to sign in with a...

  • Why am I getting compile errors. rowPuzzle.java:9: error: class, interface, or enum expected public static boolean...

    Why am I getting compile errors. rowPuzzle.java:9: error: class, interface, or enum expected public static boolean rowPuzzle(ArrayList<Integer> squares, int index, ArrayList<Boolean> visited) ^ rowPuzzle.java:16: error: class, interface, or enum expected } //Java Program import java.util.*; // rowPuzzle helper function implementation // File: rowPuzzle.cpp // Header files section // function prototypes public static boolean rowPuzzle(ArrayList<Integer> squares, int index, ArrayList<Boolean> visited) { // base case // return true if the puzzle is solvable if (index == squares.size() - 1) {    return...

  • I need help debugging this Java program. I am getting this error message: Exception in thread...

    I need help debugging this Java program. I am getting this error message: Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 2 at population.Population.main(Population.java:85) I am not able to run this program. ------------------------------------------------------------------- import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; import java.util.Scanner; /* Linked list node*/ class node { long data; long year; String country; node next; node(String c,long y,long d) { country=c; year=y; data = d; next = null; } } public class Population { private static node head; public static void push(String...

  • I am working on this code and keep getting errors like "ERROR: Syntax error: Encountered "<EOF>"...

    I am working on this code and keep getting errors like "ERROR: Syntax error: Encountered "<EOF>" at line 1, column 169." and "ERROR: Table/View 'STUDENT' does not exist. ERROR: Table/View 'STUDENT' does not exist. ERROR: Table/View 'STUDENT' does not exist." I do not know why this isn't working. Here is my code: DTCCDatabase.java import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; import java.sql.Statement; /** * This program creates the CoffeeDB database. */ public class DTCCDatabase {    public static void main(String[] args)...

  • QUESTION The ReadFile class opens and reads a text file. The WriteFile class opens and writes...

    QUESTION The ReadFile class opens and reads a text file. The WriteFile class opens and writes to a file. Compile and run these programs. There are several ways to read/write text files. The examples shown here are just one way of achieving this. Look at the API for the BufferedReader class. The readline() method is a simple way to read the text file line by line. It returns null when the end of the file has been reached. https://docs.oracle.com/javase/8/docs/api/java/io/BufferedReader.html Look...

  • Unable to find out why am I getting: Account.java:85: error: reached end of file while parsing...

    Unable to find out why am I getting: Account.java:85: error: reached end of file while parsing import java.util.*; class Account{ private int id; private double balance; private double annualInterestRate; private Date dateCreated; public Account() { id = 0; balance = 0; annualInterestRate = 0; dateCreated = new Date(); } public Account(int id1, double balance1) { id =id1; balance = balance1; dateCreated = new Date(); } public void setId(int id1) { id=id1; } public void setBalance(double balance1) { balance = balance1;...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT