Modify test score app math operator

Assignment Help Mathematics
Reference no: EM13762778

Modify Test Score App Math as described below.

1. Use the += operator to increase the scoreCount and scoreTotal variables. Then test this to makes sure it works.

2. As the user enters test scores, use the methods of the Math class to keep track of the minimum and maximum scores. When the user enter 999 to end the program, display these scores at the end of the other output data. Now, test these changes to make sure that they work.

3. Change the variable that you use to total the scores from a double to an int data type. Then use casting to cast the score count and score total to doubles as you calculate the average score and save that average as a double. Now, test that change.

4. Use the NumberFormat class to round the average score to one decimal place before displaying it at the end of the program. Then, test this change. Note that the rounding method that's used doesn't matter in a program like this.

// display operational messages

System.out.println("Please enter test scores that range from 0 to 100.");

System.out.println("To end the program enter 999.");

System.out.println(); // print a blank line

// initialize variables and create a Scanner object

double scoreTotal = 0;

int scoreCount = 0;

int testScore = 0;

Scanner sc = new Scanner(System.in);

// get a series of test scores from the user

while (testScore != 999)

{

// get the input from the user

System.out.print("Enter score: ");

testScore = sc.nextInt();

// accumulate score count and score total

if (testScore <= 100)

{

scoreCount = scoreCount + 1;

scoreTotal = scoreTotal + testScore;

}

else if (testScore != 999)

System.out.println("Invalid entry, not counted");

}

// display the score count, score total, and average score

double averageScore = scoreTotal / scoreCount;

String message = "\n" +

"Score count: " + scoreCount + "\n"

+ "Score total: " + scoreTotal + "\n"

+ "Average score: " + averageScore + "\n";

System.out.println(message);

Reference no: EM13762778

Questions Cloud

Financial information for ford and gm : Using the financial information for Ford and GM, answer the following questions.
Ritz furniture has a contribution margin ratio : Ritz Furniture has a contribution margin ratio of 0.17. If fixed costs are $171,500 how many dollars of revenue must the company generate in order to reach the break-even point?
Attend college full-time at a cost : Susan is trying to decide whether or not to attend college during the next 12-week session.
How does your protagonist relate to society : How does your protagonist relate to society? In what ways is your literary work or film Greek? What epic qualities are evident in your work?
Modify test score app math operator : Use the += operator to increase the scoreCount and scoreTotal variables. Then test this to makes sure it works.
Budgeted sales-incremental revenues : Carry-ALL plans to sell 1,300 carriers next year and has budgeted sales of $46,000 and profits of $22,000. Variable costs are projected to be $20 per unit. Michael Co. offers to pay $24,500 to buy 570 units from Carry-ALL.
Highest risk arrangement with a payer : From a hospital's perspective, what is most likely to be the highest risk arrangement with a payer?
Problems based on wastage : Discuss the economic impacts of implementing your plan versus the financial impacts of making no change in our current use.
Impact of changes in purchasing power : Which method(s) of financial reporting does (do) not recognize the impact of changes in purchasing power?

Reviews

Write a Review

Mathematics Questions & Answers

  Calculate the power required

Calculate the power required (in MW) to pump water into a backup reservoir 25 metres above the water level, if the pumps operate at a flow rate of 15,000 litres per second and the pipe friction reduces the efficiency of pumping by 18%. (g=9.81 m.s..

  The eccentricity e of an ellipse is defined as the number

the eccentricity e of an ellipse is defined as the number ca where a and c are the numbers in the defining equation.

  Calculation of probability and normal distribution

Calculation of Probability - Normal Distribution - find the probability that a randomly selected employee

  Which standard normal probability

If you purchase a six-pack of sodas, and measure the amount in each can and find the average, the probability that the average of the six cans will be between 11.9 and 12.1 oz equals which standard normal probability?

  Find the dimensions of the box requiring the least amount

a moving company wishes to design an open-top-box with square base whose volume is exactly 32 cubic feet. find the dimensions of the box requiring the least amount of materials.

  Which gets 35 miles to the gallon

How many miles would someone who purchased a $45,000 car that gets 45 miles to the gallon have to drive to come out even with the individual who purchased a car for $35,000 which gets 35 miles to the gallon?   Assume that gas costs $2.50 per gallon

  Evaluate the constant of variation and write an equation of

evaluate the constant of variation and write an equation of direct variation.for the given values of x andnbspy

  Find the dimensions of the largest field

A rectangular field, bounded on one side by a building, is to be fenced in on the other three sides.if 3,000 feet of fence is to be used, find the dimensions of the largest field that can be fenced in.

  Approximate the height of the kite

A 118 foot line is attached to a kite. When the kite has pulled the line taut,the angle of elevation to the kite is approximately 42 degrees. Approximate the height of the kite.

  How many liters of each solution were mixed

a 34% solution is mixed with a 66% solution to produce 216 liters of a 42% solution. How many liters of each solution were mixed?

  1 consider the following lppnbspwithout using artificial

1. consider the following lppnbspwithout using artificial variables solve the given lpp do not solve the dual

  What was the speed on each part of the trip

During the first part of a trip, a canoeist travels 61 miles at a certain speed. The canoeist travels 21 miles on the second part of the trip at a speed 5 mph slower. The total time for the trip is 3 hrs. What was the speed on each part of the tri..

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