Define a classes named ExamStatistics

Assignment Help Computer Engineering
Reference no: EM131971189

Examination Statistics Assignment

Learning Outcomes

  • Recognize and apply the software development phases
  • Utilize Java syntax in fundamental programming algorithms
  • Recognize and apply the various input and output devices in programming
  • Recognize and apply the various control structures
  • Design and implement user defined methods

Objectives - In completing this project you will gain experience with the following Java features:

  • the Scanner class
  • formatting
  • selection structures
  • iteration structures
  • file input-output

Problem Statement - Processing large amount of data to obtain statistical information is a frequent computer application in many areas. The most frequently calculated parameters are the average, the median and the population standard deviation.

In this project you implement a program that

  • reads examination scores from a file
  • determines the total number of scores in the file
  • calculates the average score
  • determines the maximum score and the minimum score
  • calculates the population standard deviation
  • determines the number of examination in each of the letter grade groups A, B, C, D, F
  • makes the output message displayed on the console, and writes the output to a file, as well.

Analysis and Requirements -

Input

  • named constants to store the lower score limits for the letter grade groups, these are 85, 75, 65, 55 in the order of grades A, B, C, D
  • an undetermined number of exam scores stored on an external input file; each number is an integer between 0 and 100
  • the name of the input file to be solicited from the user on the console

Output - The output will contain the following data:

  • The total number of examinations
  • The average score
  • The population standard deviation of the scores
  • The minimum score
  • The maximum score
  • The number as well as the percentage of scores in each letter grade group

A template to be followed in displaying the output is shown below (Figure 1). Your actual output may have other numerical values. Decimals must be rounded to two digits after the point. Use printf or String.format to get the output properly formatted.

Design - For this project you shall define a classes named ExamStatistics.

Add four static named constant fields to store the lower limits of the grade groups, see in Input above.

These variable are declared in the class but outside of the main method.

Within the main method, create commented places for codes responsible for various tasks.

Declare variables

You will need

  • six integer variables for counting; one counter variable is used to count the total number of scores on the file, and one additional variable is needed to count the scores for each of the grades A, B, C, D and F
  • three integer variables minScore, maxScore, nextScore; minScore and maxScore are used to store the lowest and highest score values, nextScore stores score currently read from the file
  • three double variables to store sum, average and psd
  • two String variables to store the output message and the file name

Declare and instantiate a Scanner object keyboard for console reading

Declare and instantiate a File object to the file name solicited and received from the console

Check if the file exists and repeat file name solicitation until the name accepted (a loop will be used)

Declare and instantiate another Scanner object reader to read data from the file

Run a while loop to read, count and sum the scores ("running total"); the loop must also have logic to determine maxScore, minScore, and must count the occurrences of scores in the grade groups; input values are checked, wrong input are not counted and they are ignored in the processing that is, the loop continues at the next iteration. Wrong input does not update any of the counter variables, neither the sum, maxScore and minScore variables. Note that every correct input must be fully processed at the reading; only the data currently read from the file can be stored internally by the code.

Compute the average

Re-instantiate the file reader Scanner object, you need a new Scanner since you have to read the file again

Run a for loop that makes the summation for psd, see the formula for psd

Compute psd

Compose the output message, use the String.format( ) method

Display the message on the console

Instantiate a PrintWriter object and write the output to a file named ExamStatFile

Implementation Requirements and Hints

  • Having the name of the input file read from the console, the name shall be saved in a variable, say inputFileName
  • To validate the file name

(i) declare a File object

(ii) run a while loop in which solicit, read and save a candidate for the file name

(iii) instantiate the File object to the file name

(iv) check if the file exists, if it does not, continue the loop, otherwise stop the loop

First file reading:

  • In the while loop that reads the scores from the file

(i) Save the currently read input in nextScore

(ii) You may assume that the data read is numeric value, but the input must validated to the required bounds; wrong input is ignored, the loop turns to the next iteration

(iii) Update the total counter

(iv) Check if nextScore is greater than maxScore, if so update maxScore with nextScore

(v) Repeat the checking for minScore

(vi) Apply a nested if else if structure to determine the grade group relevant for nextScore and update the group counter; as an alternate option you are allowed to use a properly crafted switch statement rather than if-else statements

(vii) Add nextScore to sum

  • After the loop, compute average by applying the average formula; care for the integer division, average must be exact

Second file reading:

  • Note that the score data are not stored internally by the program, and to compute the standard deviation (psd) the average must have been determined. Therefore average and psd cannot be simultaneously calculated in one file reading process. In order to compute the value of psd, the file containing the data (inputFileName) must be read once more by a new Scanner
  • As for the second reading of the file, a for loop is applicable since the total number of admissible items in the file is known. Input evaluation is still necessary to discard the wrong inputs. You may decide if you want to use a while loop for the second reading, or you want to apply a for loop.
  • Having the second loop completed and psd determined, the output message containing the obtained results must be built; decimal numbers in the output must be formatted and rounded to two digits after the point
  • Declare and instantiate a PrintWriter object to write the output to a file named ScoreStatistics.txt
  • Print the output to console and write output to file as required
  • Start your work on this project without delay.

 

Reference no: EM131971189

Questions Cloud

Explain how diego velazquez establishes : In the painting Las Meninas, explain how Diego Velázquez establishes more than one focal point?
Meeting the standards of the nasw : What is the best way to list whether or not a social service agency is meeting the standards of the NASW? Are bullets acceptable in a essay?
Explain the steps you took to address the issue : Decision making and conflict resolution can consume a disproportionate amount of a manager's time. Recognizing and preempting potential conflicts often proves.
Implications in discipline of education : Summary of Cultural capital by Pierre Bordieu and its implications in discipline of education.
Define a classes named ExamStatistics : CS160 - 01/02 Project - Examination Statistics Assignment. Design - For this project you shall define a classes named ExamStatistics
Relationship between humankind-technology in information age : The Second Renaissance and How do you think films explore the relationship between humankind and technology in the Information Age?
Enhance the brain better than electronic devices : It can help you past time, have a higher understanding of vocabulary, and that it can enhance the brain better than electronic devices.
How the talent management process is a strategy : Examine how the talent management process is a strategy for a competitive advantage for your organization. Assess how the talent management strategy should.
Explain what transactions were executed : The index was at 392.54, the continuously compounded risk- free rate was 2.83%, the dividend yield was 2.08%, and the contract expired on September 20.

Reviews

len1971189

5/5/2018 1:59:36 AM

Documentation and style: 20 points. Your program must conform to the Computer Science Department’s Java Documentation and Style Requirements. Emphasis will be placed on having the required banner and internal comments, indentation, and overall stylish appearance. Comments must be clearly written with correct grammar and spelling. Documentation and style weigh heavily in the score, do not neglect them.

len1971189

5/5/2018 1:59:30 AM

Correctness: 80 points. Correct declarations of all variables - 05 Points, Correct instantiation of all objects - 05 Points. Correct implementation of file name solicitation - 10 Points. Correct implementation of the while loop reading the file first - 25 Points. Correct implementation of the loop of second reading – 15 Points, Correct construction of the output message to follow the template - 10 Points and Correct implementation of PrintWriter - 10 Points.

Write a Review

Computer Engineering Questions & Answers

  Mathematics in computing

Binary search tree, and postorder and preorder traversal Determine the shortest path in Graph

  Ict governance

ICT is defined as the term of Information and communication technologies, it is diverse set of technical tools and resources used by the government agencies to communicate and produce, circulate, store, and manage all information.

  Implementation of memory management

Assignment covers the following eight topics and explore the implementation of memory management, processes and threads.

  Realize business and organizational data storage

Realize business and organizational data storage and fast access times are much more important than they have ever been. Compare and contrast magnetic tapes, magnetic disks, optical discs

  What is the protocol overhead

What are the advantages of using a compiled language over an interpreted one? Under what circumstances would you select to use an interpreted language?

  Implementation of memory management

Paper describes about memory management. How memory is used in executing programs and its critical support for applications.

  Define open and closed loop control systems

Define open and closed loop cotrol systems.Explain difference between time varying and time invariant control system wth suitable example.

  Prepare a proposal to deploy windows server

Prepare a proposal to deploy Windows Server onto an existing network based on the provided scenario.

  Security policy document project

Analyze security requirements and develop a security policy

  Write a procedure that produces independent stack objects

Write a procedure (make-stack) that produces independent stack objects, using a message-passing style, e.g.

  Define a suitable functional unit

Define a suitable functional unit for a comparative study between two different types of paint.

  Calculate yield to maturity and bond prices

Calculate yield to maturity (YTM) and bond prices

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd