Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Your assignment is to write a class averaging program that outputs a summary of classes and students, given the above input data. For a high-level

Your assignment is to write a class averaging program that outputs a summary of classes and students, given the above input data. For a high-level view, look at the sample program execution below. (The report goes to the console. If this assignment is too easy, for an added challenge, have the report be written in a GUI using JOptionPane.):

Grade Data For Class 161 ID Programs (Midterm) Final Weighted Average Programs grade -- -------- ------- ----- ---------------- -------------- 3333 70 60 50 59.00 Pass 4444 50 50 50 50.00 Fail 5555 80 90 80 83.00 Pass Class Average: 64.00 Grade Data For Class 162 ID Programs (Midterm) Final Weighted Average Programs grade -- -------- ------- ----- ---------------- -------------- 1212 90 85 92 ... Pass 6666 60 80 90 ... Fail 7777 90 90 90 ... Pass 8888 95 87 93 ... Pass 9999 75 77 73 ... Pass Class Average: ... Grade Data For Class 263 ID Programs (Midterm) Final Weighted Average Programs grade -- -------- ------- ----- ---------------- -------------- 2222 . . . 8989 . . . 9090 . . . Class Average: ...

The ellipses refer to calculated values, not included in the above example but which your program should calculate.

The columns Programs, Midterm, and Final in the output above (i.e., from the file) are raw scores (not weighted). The only calculation that involves manipulation of weights and grades is the weighted average. The Weighted Average is calculated using the following sum of products:

(programsWeight*programsGrade) + (midtermWeight*midtermGrade) + (finalWeight*finalGrade)

The Pass/Fail determination is made based only on the raw score of the students programs. If the students programs score is greater than or equal to 70, they pass. If less than 70, they fail.

Also, if your program has multiple loops (one per course, one per student, etc.), which you should ignore when initially tackling this problem. When solving this problem, it may be best to focus first on the innermost loop that deals with students. Deferring higher-level details in favor of fleshing out individual cases first can be thought of as an inside-out approach (commonly called Bottom-Up Design, related to Stepwise Refinement). This is similar to ignoring a forest and paying attention to just one tree. For example, you could start by focusing on just one class first and building the loop to process each student until a 0 is reached. Once this is working for one class, you can wrap this logic inside of a loop and extend its functionality to process multiple classes.

Finally, the real data may differ from the sample data with respect to actual scores used (and the number of students in a class and/or the number of classes), but will not vary with respect to file format. This simply means that your program should work with multiple files formatted in the same fashion, and not just with the values in the sample file.

Example Code Skeleton

Here is a skeleton code you could use as a starting point for your project:

import java.util.Scanner; import java.io.File; import java.io.IOException; public class HW_LOOPS_FILES { //... class constants go here ... public static void main(String[] args) { int courseNumber; // Number of the course Scanner inputFile = null; // File containing data (p. 297 // in Savitch discusses null) // ... code assigning inputFile in a try/catch statement // ... code for any stuff you need to do one time ... //Per class, print a table of ID numbers, grades, weighted average // per student, and a Pass or Fail programs grade. The class // average is also printed. for (...) { // Read class number, print class number title, headings. courseNumber = inputFile.nextInt(); ... rest of the code goes here ... // initialization ... code goes here ... // Loop to handle one class: // For each student in the class, get and print their // information, compute their avg, and sum the avgs. while (...) { ... code goes here ... } // compute and print class average ... code goes here ... } }

Feel free to use something different. There are any number of solutions and this skeleton is merely one possible acceptable structure for this assignment. However, make sure whatever solution you use satisfies the possible grading criteria. (For instance, in the above skeleton method calls are left for you to fill in; this does not mean that your program should be one big main method with no other methods.)

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

Principles Of Database Systems With Internet And Java Applications

Authors: Greg Riccardi

1st Edition

020161247X, 978-0201612479

More Books

Students also viewed these Databases questions

Question

e. What are notable achievements of the group?

Answered: 1 week ago