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

JAVA PROGRAMMING Part 1 Create a class Student, with attributes id, first name, last name. (All...
JAVA PROGRAMMING Part 1 Create a class Student, with attributes id, first name, last name. (All the attributes must be String) Create a constructor that accepts first name and last name to create a student object. Create appropriate getters and setters Create another class StudentOperationClient, that contains a main program. This is the place where the student objects are created and other activities are performed. In the main program, create student objects, with the following first and last names. Chris...
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...
Using Java, Ask for the runner’s name Ask the runner to enter a floating point number...
Using Java, Ask for the runner’s name Ask the runner to enter a floating point number for the number of miles ran, like 3.6 or 9.5 Then ask for the number of hours, minutes, and seconds it took to run A marathon is 26.219 miles Pace is how long it takes in minutes and seconds to run 1 mile. Example Input: What is your first name? // user enters Pheidippides How far did you run today? 10.6 // user enters...
Using Java, Ask for the runner’s name Ask the runner to enter a floating point number...
Using Java, Ask for the runner’s name Ask the runner to enter a floating point number for the number of miles ran, like 3.6 or 9.5 Then ask for the number of hours, minutes, and seconds it took to run Format the numbers with leading 0's if the pace is 8 minutes and 3 second, it should be 8:03 and for marathon time, if its 1 hour and 15 minutes and 9 seconds, it should be 1:15:09 Please read through...
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...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT