Loop that will execute as many times as user directs

Course Queries Syllabus Queries 2 years ago

0 1 0 0 0 tuteeHUB earn credit +10 pts

5 Star Rating 1 Rating

Posted on 16 Aug 2022, this text provides information on Syllabus Queries related to Course Queries. Please note that while accuracy is prioritized, the data presented might not be entirely correct or up-to-date. This information is offered for general knowledge and informational purposes only, and should not be considered as a substitute for professional advice.

Take Quiz To Earn Credits!

Turn Your Knowledge into Earnings.

tuteehub_quiz

Answers (1)

Post Answer
profilepic.png
manpreet Tuteehub forum best answer Best Answer 2 years 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
                                                
                                                
0 views
0 shares

No matter what stage you're at in your education or career, TuteeHub will help you reach the next level that you're aiming for. Simply,Choose a subject/topic and get started in self-paced practice sessions to improve your knowledge and scores.