Categories

See More
Popular Forum

MBA (4887) B.Tech (1769) Engineering (1486) Class 12 (1030) Study Abroad (1004) Computer Science and Engineering (988) Business Management Studies (865) BBA (846) Diploma (746) CAT (651) B.Com (648) B.Sc (643) JEE Mains (618) Mechanical Engineering (574) Exam (525) India (462) Career (452) All Time Q&A (439) Mass Communication (427) BCA (417) Science (384) Computers & IT (Non-Engg) (383) Medicine & Health Sciences (381) Hotel Management (373) Civil Engineering (353) MCA (349) Tuteehub Top Questions (348) Distance (340) Colleges in India (334)
See More

Loop that will execute as many times as user directs

Course Queries Syllabus Queries
Max. 2000 characters
Replies

usr_profile.png
Rahul Chaudhary

User

( 5 months ago )

 

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
			
        

what's your interest