Hi I am just beginning using Java and have two programs due tomorrow for class. Both programs are nearly complete however I keep getting similar errors on both. The first program's error is on the 22nd line starting "system.out." and says that a ) is expected. Here is what I have so far.

import java.util.Scanner;

public class wage {

public static void main(String[] args) {

Scanner input = new Scanner( System.in );

double pay = 0.0;
double hours = 0.0;
int dollars = 0;
int cents = 0;

System.out.print("Please input pay ");
pay = input.nextInt();

System.out.print("Please input number of hours ");
hours = input.nextInt();

dollars = (int)(pay/hours);

System.out.printIn("Your average hourly pay rate is $ " (+ dollars +));

}
}

My second program's error is in the 38th line where it says there is an illegal start of expression and a ) needed. This program is seen below.

import java.util.Scanner;

public class gpatwo {

public static void main(String[] args) {

Scanner input = new Scanner( System.in );

int a = 4;
int b = 3;
int c = 2;
int d = 1;
int f = 0;

int grade1;
int grade2;
int grade3;
int grade4;
int gradesum;
int gpa;

System.out.print("Please input first grade: ");
grade1 = input.nextInt();

System.out.print("Please input second grade: ");
grade2 = input.nextInt();

System.out.print("Please input third grade: ");
grade3 = input.nextInt();

System.out.print("Please input fourth grade: ");
grade4 = input.nextInt();

gradesum = grade1 + grade2 + grade3 + grade4;

gpa = gradesum / 16;

System.out.printf("Your GPA is: " + gpa +);

}
}

Any help would be appreciated. Thanks!

Code tags please:

[code=JAVA] // paste code here

[/code]

Check your spelling:

System.out.[COLOR="Red"]printIn[/COLOR]("Your average hourly pay rate is $ " (+ dollars +));

Also just a suggestion you can drop the extra parenthesis ( the "(" and ")") around "+dollar+".

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.