Ask Computer Engineering Expert

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.

 

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M92808842
  • Price:- $40

Priced at Now at $40, Verified Solution

Have any Question?


Related Questions in Computer Engineering

Does bmw have a guided missile corporate culture and

Does BMW have a guided missile corporate culture, and incubator corporate culture, a family corporate culture, or an Eiffel tower corporate culture?

Rebecca borrows 10000 at 18 compounded annually she pays

Rebecca borrows $10,000 at 18% compounded annually. She pays off the loan over a 5-year period with annual payments, starting at year 1. Each successive payment is $700 greater than the previous payment. (a) How much was ...

Jeff decides to start saving some money from this upcoming

Jeff decides to start saving some money from this upcoming month onwards. He decides to save only $500 at first, but each month he will increase the amount invested by $100. He will do it for 60 months (including the fir ...

Suppose you make 30 annual investments in a fund that pays

Suppose you make 30 annual investments in a fund that pays 6% compounded annually. If your first deposit is $7,500 and each successive deposit is 6% greater than the preceding deposit, how much will be in the fund immedi ...

Question -under what circumstances is it ethical if ever to

Question :- Under what circumstances is it ethical, if ever, to use consumer information in marketing research? Explain why you consider it ethical or unethical.

What are the differences between four types of economics

What are the differences between four types of economics evaluations and their differences with other two (budget impact analysis (BIA) and cost of illness (COI) studies)?

What type of economic system does norway have explain some

What type of economic system does Norway have? Explain some of the benefits of this system to the country and some of the drawbacks,

Among the who imf and wto which of these governmental

Among the WHO, IMF, and WTO, which of these governmental institutions do you feel has most profoundly shaped healthcare outcomes in low-income countries and why? Please support your reasons with examples and research/doc ...

A real estate developer will build two different types of

A real estate developer will build two different types of apartments in a residential area: one- bedroom apartments and two-bedroom apartments. In addition, the developer will build either a swimming pool or a tennis cou ...

Question what some of the reasons that evolutionary models

Question : What some of the reasons that evolutionary models are considered by many to be the best approach to software development. The response must be typed, single spaced, must be in times new roman font (size 12) an ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As