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...

  • 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...

  • 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...

  • 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...

  • Write a C++ program that asks user number of students in a class and their names....

    Write a C++ program that asks user number of students in a class and their names. Number of students are limited to 100 maximum. Then, it will ask for 3 test scores of each student. The program will calculate the average of test scores for each student and display with their names. Then, it will sort the averages in descending order and display the sorted list with students’ names and ranking. Follow the Steps Below Save the project as A4_StudentRanking_yourname....

  • 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...

  • hello. i need help with number 2 ONLY 1. Use if statements to write a Java...

    hello. i need help with number 2 ONLY 1. Use if statements to write a Java program that inputs a single letter and prints out the corresponding digit on the telephone. The letters and digits on a telephone are grouped this way 2=ABC 3 = DEF 4 GHI 5 JKL 6 - MNO 7 - PRS 8 - TUV 9-WXY No digit corresponds to either Qor Z. For these 2 letters your program should print a message indicating that they...

  • How do i write the pseudocode for this java code? First, write out pseudocode, and then create a program to help you by accomplishing the following tasks: :  Use command line interface to ask the use...

    How do i write the pseudocode for this java code? First, write out pseudocode, and then create a program to help you by accomplishing the following tasks: :  Use command line interface to ask the user to input the following. ○ How many apples are on hand ○ How many apples should be in stock ○ How many oranges are on hand ○ How many oranges should be in stock  Perform an operation to determine how many of...

  • Declare and initialize 4 Constants for the course category weights: The weight of Homework will be...

    Declare and initialize 4 Constants for the course category weights: The weight of Homework will be 15% The weight of Tests will be 35% The weight of the Mid term will be 20% The weight of the Fin al will be 30% Remember to name your Constants according to Java standards. Declare a variable to store the input for the number of homework scores and use a Scanner method to read the value from the Console. Declare two variables: one...

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
ADVERTISEMENT