Question

In: Computer Science

11) Enter the following using Java. Use for loop to enter student id, student name, major...

11) Enter the following using Java.

Use for loop to enter student id, student name, major and grades. Also grades should display their letter grades based on their conditions.

After that display the name of students and their info, and also their letter grade

After that display the sum of all grades and the average

Output Example:

Student ID: 0957644

Student Name: Pedro Hernandez

Student Major: Business Information Systems

Grades for Fall 2020:

Introduction to Computer Science using Java: 85, B

Statistics: 85, B

Introduction to Psychology: 92, A

English Composition II: 84, B

Sum = 346

Average= 86.5, B

Solutions

Expert Solution

Code

import java.io.BufferedReader;

import java.io.IOException;

import java.io.InputStreamReader;

public class Testq {

public static void main(String[] args) throws IOException {

BufferedReader console = new BufferedReader(new InputStreamReader(System.in));

System.out.println("Please Enter Number of Students details you want to enter: ");

int userInput = Integer.parseInt(console.readLine());

double sum=0;

for (int i = 0; i < userInput; i++) {

System.out.print("Student ID: ");

String sid = console.readLine();

System.out.print("Student Name: ");

String sname = console.readLine();

System.out.print("Student Major: ");

String smajor = console.readLine();

System.out.println("Grades for Fall 2020: ");

System.out.print("Introduction to Computer Science using JAVA: ");

String marksJava = console.readLine();

sum += Double.parseDouble(marksJava.split(",")[0]); //calculate sum of marks.

System.out.print("Statistics: ");

String marksStats = console.readLine();

sum += Double.parseDouble(marksStats.split(",")[0]);

System.out.print("Introduction to Psychology: ");

String marksPhyschology = console.readLine();

sum += Double.parseDouble(marksPhyschology.split(",")[0]);

System.out.print("English Composition II: ");

String marksEnglish = console.readLine();

sum += Double.parseDouble(marksEnglish.split(",")[0]);

System.out.print("Sum = " + sum + "\n");

double average = sum/4;

if(average >=90)

System.out.print("Average= " + average + ", A");

if(average >=80 && average <90)

System.out.print("Average= " + average + ", B");

if(average <80)

System.out.p rint("Average= " + average + ", C");

}

}

}

Input/Output:

Please Enter Number of Students details you want to enter:

1

Student ID: 0957644

Student Name: Pedro Hernandez

Student Major: Business Information System

Grades for Fall 2020:

Introduction to Computer Science using JAVA: 85,B

Statistics: 85,B

Introduction to Psychology: 92,A

English Composition II: 84,B

Sum = 346.0

Average= 86.5, B

Screenshot for reference :

Please, please UPVOTE, it's really important to me. Thanks


Related Solutions

Code in Java Write a Student class which has two instance variables, ID and name. This...
Code in Java Write a Student class which has two instance variables, ID and name. This class should have a two-parameter constructor that will set the value of ID and name variables. Write setters and getters for both instance variables. The setter for ID should check if the length of ID lies between 6 to 8 and setter for name should check that the length of name should lie between 0 to 20. If the value could not be set,...
Write a JAVA program that prompts the user to enter a single name. Use a for...
Write a JAVA program that prompts the user to enter a single name. Use a for loop to determine if the name entered by the user contains at least 1 uppercase and 3 lowercase letters. If the name meets this policy, output that the name has been accepted. Otherwise, output that the name is invalid.
Write a Java program for a restaurant with the following features: ◦ Customer: Name, Surname, ID...
Write a Java program for a restaurant with the following features: ◦ Customer: Name, Surname, ID (incremental ID by 1 for each new customer), Email, Phone, Address. ◦ Service: ID (incremental ID by1 for each group),CustomerID, Priority (High, Medium, Low, Other), ResolutionTimeFrame (Measured in Man hours), AssignedUser, Status(resolved or not), Fee. ◦ User (simple user of system): ID, Name, Surname, Username and Password (insert from code five fixed users), Address , PhoneNumber ◦ Manager: Name, Surname, Username and Password (insert...
#Python program using loop instead of numpy or pandas. Write a function to enter n student...
#Python program using loop instead of numpy or pandas. Write a function to enter n student scores from 0 to 100 to represent student score, Count how many A (100 - 90), B(89-80), C(79-70), D(69-60), F(<60) We will use numpy array OR pandas later for this problem, for now use loop Invoke the function with 10 student scores, show the result as follow: Test Enter 10 scores Enter a student score: 99 Enter a student score: 88 Enter a student...
Java Requirements: The ATM system will require users to enter a valid ID . If the...
Java Requirements: The ATM system will require users to enter a valid ID . If the entered ID matches to one of the Accounts’ ID, the system will present the user an ATM menu. The ATM menu asks the user to enter a choice, and depending on the user’s choice it may ask for additional input (i.e., withdraw or deposit amount).  The code should show for each user choice as shown in the sample-run figure at the end. ...
Using files, Write a Java program to read 2 tutorials group of student id, assignment mark...
Using files, Write a Java program to read 2 tutorials group of student id, assignment mark (30), lab test mark(20) from 2 input files namely group1.txt and group 2.txt. Your program will calculate the total course work marks and write in to 3 output files with the following conditions: if the total course work marks are more than 40 out 50 write in to LIST1.TXT if the total course work marks are between 30 to 40 then write in to...
Student Structure Assignment Create a Student Structure globally consisting of student ID, name, completed credits, and...
Student Structure Assignment Create a Student Structure globally consisting of student ID, name, completed credits, and GPA. Define one student in main() and initialize the student with data. Display all of the student’s data on one line separated by tabs. Create another student in main(). Assign values to your second student (do not get input from the user). Display the second student’s data on one line separated by tabs. Create a third student in main(). Use a series of prompts...
Java Program. Sentinel While Loop Lab Do the following: Prompts the user to enter a grade...
Java Program. Sentinel While Loop Lab Do the following: Prompts the user to enter a grade or a -1 to quit. IF the user entered a -1 THEN Display a message that the User is done entering grades ELSE Count each grade as it is entered. Compute a running total of the grades entered. END IF After the user enters the sentinel of -1, calculate the average of the grades entered. When computing the average, make sure that there is...
​​​​​​​For java program. Write a while loop that will let the user enter a series of...
​​​​​​​For java program. Write a while loop that will let the user enter a series of integer values and compute the total values and number of values entered. An odd number will stop the loop. Display the number of iterations and the total of the values after the loop terminates. for Loop Write a for loop to display all numbers from 13 - 93 inclusive, ending in 3. Write a for loop to display a string entered by the user...
Java program Use Do-while Write a do-wile loop that asks the user to enter two numbers....
Java program Use Do-while Write a do-wile loop that asks the user to enter two numbers. The numbers should be added and the sum displayed. The loop should ask the user whether he or she wishes to perform the operation again. If so, the loop should repeat, otherwise, it should terminate. Use Continue branching statement Write a program that reads an integer and display all the positive ODD numbers from 0 to n (integer entered by the user). Use CONTINUE...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT