Question

I need help writing a pseudocode: JAVA Write a pseudocode algorithm that asks the user for...

I need help writing a pseudocode: JAVA

Write a pseudocode algorithm that asks the user for their grades in CSE 1321, along with their attendance, then calculates their final grade. Note, perfect attendance rounds up your final grade by 1.5 points – otherwise, it’s a fraction out of 30. The tests and quiz average are worth 20% each. Sample Output: Enter your grade for Test 1: 95 Enter your grade for Test 2: 85 Enter your grade for Test 3: 63 Enter your grade for Test 4: 70 Enter your average quiz grade: 81 Enter the number of times you attended class (max 30): 29 Your average before attendance is 78.8. You receive an additional 1.45 points for attendance. Final grade is 80.25.

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

The java pseudocode for the problem:

  1. preAvg(int test[], int qgrade):
  2. sum := 0
  3. for each testi in test:
  4. sum := sum + testi
  5. sum := sum + qgrade
  6. return sum / 5
  7. additional(int at):
  8. res = (at * 1.5) / 30
  9. return res
  10. total = preAvg(test, qgrade) + additional(at)

The java code for the same:

import java.util.Scanner;

public class CSE1322 {

   public static void main(String[] args) {
      
       Scanner scanner=new Scanner(System.in);
      
       int test[] = new int[4];
      
       for(int i=1;i<=4;i++){
           System.out.println("Enter your result for test"+i+": ");
           test[i-1] = scanner.nextInt();
       }
      
       System.out.println("Enter the average quiz grade: ");
       int qgrade = scanner.nextInt();
      
       System.out.println("Enter the classes you attended(out of 30): ");
       int at = scanner.nextInt();
      
       double avg = preAvg(test,qgrade);
       System.out.println("Your average before attendance is: "+avg);
      
       double add = additional(at);
       System.out.println("You receive an additional "+add+" points for attendance");
      
       double total = avg + add;
      
       System.out.println("Final grade is : "+total);
      
   }

   private static double additional(int at) {
       double res = ((double)at * 1.5)/30.0;
       return res;
   }

   private static double preAvg(int[] test, int qgrade) {
       double sum = 0;
      
       for(int i=0;i<4;i++) sum += test[i];
      
       sum += qgrade;
      
       return sum/5;
   }

}

Refer below screenshots for the same:

Output:

1 import java.util.Scanner; PSONQueen/src/Particle.java amino public class CSE1322 { public static void main(String[] args) { Scanner scanner=new Scanner(System.in); int test[] = new int[4]; for(int i=1;i<=4;i++){ System.out.println("Enter your result for test"+i+": "); test[i-1] = scanner.nextInt(); System.out.println("Enter the average quiz grade: "); int qgrade = scanner.nextInt(); 9 System.out.println("Enter the classes you attended (out of 30): "); int at = scanner.nextInt(); double avg = preavg(test, qgrade); System.out.println("Your average before attendance is: "+avg); double add = additional(at); System.out.println("You receive an additional "+add+" points for attendance"); double total = avg + add; System.out.println("Final grade is : "+total); private static double additional(int at) { double res = ((double)at * 1.5)/30.0; return res;

390 40 private static double preAvg(int[] test, int qgrade) { double sum = 0; 41 42 for(int i=0;i<4; i++) sum += test[i]; sum += qgrade; return sum/5;

Enter your result for testi: 95 Enter your result for test2: 85 Enter your result for test3: 63 Enter your result for test4: 70 Enter the average quiz grade: 81 Enter the classes you attended out of 30): 29 Your average before attendance is: 78.8 You receive an additional 1.45 points for attendance Final grade is : 80.25

Add a comment
Know the answer?
Add Answer to:
I need help writing a pseudocode: JAVA Write a pseudocode algorithm that asks the user for...
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
  • In Java please with pseudocode :) Assignment3C:   I just didn’t wanna take it!   We have a very...

    In Java please with pseudocode :) Assignment3C:   I just didn’t wanna take it!   We have a very forgivingexam policy.  If you miss Test 1, Test 2 or Test 3 for any reason (receiving a 0), thatexam will be replaced by whatever grade you get on the final(which is comprehensive).  Of course, that’s a risky move (it’s better to take the exams than rely on the final), but it helps students when “life gets in the way.”  The finalexam also replaces your lowest test grade...

  • I need Pseudocode Algorithm only, please Write a program that asks the user to enter the...

    I need Pseudocode Algorithm only, please Write a program that asks the user to enter the name of his or her favorite city. use a String variable to store the input. The program should display the following: The number of characters in the city name the name of the city in all uppercase letters the name of the city in all lower case letters the first character in the name of the city

  • this is the qestion it has to be in java Example of what i need y...

    this is the qestion it has to be in java Example of what i need y Booleato Tools Window Help Hesustor X C C CB https:/class.mimiloassignments/e645f0d9-8eb-4d9b-818-6bb684bBeb/do/90db2810 O Reset to Starter 10 points possible CH4 Exerc. Seved Question 3 Question 3 Write a program that prompts the user for student grades and displays the highest and lowest grades in the class. The user should enter a character to providing values Grading Full Screen • MaxMinGrades.Java New } catch (Exception e) {...

  • Plz help!! The programming language is C and could you write comments as well? Problem 2....

    Plz help!! The programming language is C and could you write comments as well? Problem 2. Calculate Grades (35 points) Arrays can be used for any data type, such as int and char. But they can also be used for complex data types like structs. Structs can be simple, containing simple data types, but they can also contain more complex data types, such as another struct. So you could have a struct inside of a struct. This problem deals with...

  • I asked a question similar to this one, which was answered perfectly. Another practice problem is...

    I asked a question similar to this one, which was answered perfectly. Another practice problem is now asking me to use two classes and get user input. For this Java program, you will write two classes: GradeCalculator and GradeCalculatorDriver In the GradeCalculator class, compute the final average and letter grade for a particular student. The final average is calculated according to the following rules: 1) There are ten exams scored out of 100 points 2) The lowest exam score is...

  • This is a C program. please help me to write a pseudocode of the program ....

    This is a C program. please help me to write a pseudocode of the program . also, I want the program In a do...while loop and the screen output should look like in the picture. please help me. 3.1. Write a program that asks the user to continue to enter two numbers (at a time). For each pair of numbers entered, the program calculates the product of those two numbers, and then accumulate that product. For each pair of numbers...

  • Hey, need some help in Java. I'm stuck on one step that prevents me from doing...

    Hey, need some help in Java. I'm stuck on one step that prevents me from doing the rest of the steps and need help on it. I also have a problem when I print databaseCourse and programmingCourse. instead of saying 5 and 7 respectively is shows 51 and 71. Step 8: in CourseGrades, create a method, add, that takes two parameters, studentNum and grade, and changes the grade of student studetNum to the given grade, grade. studentNum represents the student...

  • Introducing JOptionPane. The Learning Goal for this exercise is to interact with a user with JOptionPane...

    Introducing JOptionPane. The Learning Goal for this exercise is to interact with a user with JOptionPane and use that instead of Scanner for user input and output. PowerShell or Terminal is not a standard way that users interact with programs. Windows and dialog boxes are very natural. JOptionPane will allow you to get information to and from a user. Create a Calculator that will calculate the grade in this course. _Create a Java Program that can calculate your final grade...

  • using java Program: Please read the complete prompt before going into coding. Write a program that...

    using java Program: Please read the complete prompt before going into coding. Write a program that handles the gradebook for the instructor. You must use a 2D array when storing the gradebook. The student ID as well as all grades should be of type int. To make the test process easy, generate the grade with random numbers. For this purpose, create a method that asks the user to enter how many students there are in the classroom. Then, in each...

  • this is a java course class. Please, I need full an accurate answer. Labeled steps of...

    this is a java course class. Please, I need full an accurate answer. Labeled steps of the solution that comply in addition to the question's parts {A and B}, also comply with: (Create another file to test the class and output to the screen, not an output file) please, DO NOT COPY others' solutions. I need a real worked answer that works when I try it on my computer. Thanks in advance. Write the definition of the class Tests such...

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