Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Convert to C++ import java.io.*; import java.text.NumberFormat; // for number formatting public class ClassAverageBR { public static void main(String[] args) throws IOException { //declare and

Convert to C++

import java.io.*; import java.text.NumberFormat; // for number formatting public class ClassAverageBR { public static void main(String[] args) throws IOException { //declare and initialize variables int score; int sumOfScoresByStudent = 0; int sumOfAllScores = 0; double classAverage; BufferedReader dataIn = new BufferedReader(new InputStreamReader(System.in)); String studentName; String scoreStr; String studentNameMessage = "Enter the name of the student:"; String numOfStudentStr = "Enter the number of students: "; String numOfScoresStr = "Enter the number of scores to be entered per student: "; String outputTable = "Names, scores, average scores, and letter grades: "; NumberFormat numFormatter = NumberFormat.getNumberInstance(); numFormatter.setMinimumFractionDigits(1); numFormatter.setMaximumFractionDigits(1); //get input from user System.out.println(numOfStudentStr); int numOfStudents = Integer.parseInt(dataIn.readLine()); System.out.println(numOfScoresStr); int numOfScores = Integer.parseInt(dataIn.readLine()); //declare arrays int[][] scores = new int[numOfStudents][numOfScores]; String[] students = new String[numOfStudents]; double[] avgScores = new double[numOfStudents]; char[] letterGrades = new char[numOfStudents]; //get more user input, load arrays, and process data for (int i = 0; i= 90) theGrade = 'A'; else if (averageScore >= 80) theGrade = 'B'; else if (averageScore >= 70) theGrade = 'C'; else if (averageScore >= 60) theGrade = 'D'; else theGrade = 'F'; return theGrade; }// end findGrade }// end class

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases Illuminated

Authors: Catherine Ricardo

2nd Edition

1449606008, 978-1449606008

More Books

Students also viewed these Databases questions