Write a program to calculate the current grade based on the CSE 1341 syllabus. The program should prompt the user for their first and last name. It will then pass those names as Strings to the second method of the CSE1341Grade class. The name of the second method will be calcGrade. This method will prompt the user for the count of exam scores, count of quiz scores, and count of lab scores to entered by the user.
It will then utilize repetition structure to prompt for exam grades, quiz grades and lab grades based on the previous counts entered. For example, if the user entered count of exam scores to be 2; then the program will loop 2 times to input the two exam grades; and similarly for the count of quiz and count lab grades.
Assume you have a 100% attendance record and you will get all 5% of the attendance grade. Use the syllabus to determine the weights of each of the categories such as the exams, quizzes and labs. Add 5% to the total score since you had perfect attendance. Assume: all exams, labs and quiz scores are out of 100 points. Sample Run: 
java CSE1341Grade
First name: James
Last name: Bond
How many exam grades do you have? 1
How many quiz grades do you have? 2
How many lab grades do you have? 2
Enter exam 1 score: 90
Enter quiz 1 score: 80
Enter quiz 2 score: 80
Enter lab 1 score: 90
Enter lab 2 score: 90
Total Score: 84.55
James Bond your grade is a: B
^^That is my homework assignment, and this is what I have done so far
import java.util.Scanner;
public class CSE1341Grade
{
public static void main(String [] args)
{
//set up Scanner for user input, prompt for first name, define variable, and print response
Scanner s = new Scanner(System.in);
System.out.print("First name: ");
String first = s.nextLine();
System.out.printf(" %s\n", first);
//prompt user for last name, define variable, and print response
System.out.print("Last name: ");
String last = s.nextLine();
System.out.printf(" %s\n", last);
}
public static void calcGrade(String first, String last)
{
//prompt user for number of exam grades, define exam variable, print response
System.out.print("How many exam grades do you have? ");
String exam = s.nextLine();
System.out.printf(" %s\n", exam);
//prompt user for number of quiz grades, define quiz variable, print response
System.out.print("How many quiz grades do you have? ");
String quiz = s.nextLine();
System.out.printf(" %s\n", quiz);
//prompt user for number of lab grades, define lab variable, print response
System.out.print("How many lab grades do you have? ");
String lab = s.nextLine();
System.out.printf(" %s\n", lab);
while (exam != -1)
{
System.out.print("Enter " exam 1 " score: ", ++exam)
//define variables for computations
int score = 0;
int grade = 0;
//if statement to determine the final letter grade
if(score >= 90 && score <=100){
grade = 'A'; }
else if(score >=80 && score < 90){
grade = 'B'; }
else if(score >= 70 && score < 80){
grade = 'C'; }
else if(score >=60 && score < 70){
grade = 'D'; }
else {
grade = 'F'; }
}
}
My problem is figuring out how to create a loop that will prompt the user for however many exam grades needed.
I have performed few changes to your code based in the comments ..
Here you can see the diff
http://www.mergely.com/LIckVifT/
Note: It still does not finish your homework :-)
Update: Since the index in the foor loop does not really matters you could use it as this:
for (int i = 1; i <= examsCount; i++) {
// using i+1 to print starting from 1 instead of 0
System.out.print("Enter " + i + " score: ");
instead of
for (int i = 0; i < examsCount; i++) {
// using i+1 to print starting from 1 instead of 0
System.out.print("Enter " + (i + 1) + " score: ");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With