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

  The cost per unit of producing product

The cost per unit of producing each product will be determined by whether a new union labor contract passes or fails. The cost per unit of each product, giving each contract result is shown in the following pay off table.

  Several statistical tests have a manner to measure effect

several statistical tests have a way to measure effect size. what is this and when might you want to use it in looking

  Sketch the graph from information

Sketch the graph from information.

  The bookstore employee can service 50 students per hour

1. prepare a master production schedule mps chart using the following information.nbsp weekly demand weeks 1 thru 6 810

  Question 1 in a survey of children who saw three different

question 1. in a survey of children who saw three different shows at walt disney world the following information was

  Use z score to solve the probability

Use z score to solve the probability. Fluctuation in the prices of precious metals such as gold have been empirically shown to be well approximated by a normal distribution when observed over short interval of time.

  Find the length of the room if the cost of carpeting

find the length of the room if the cost of carpeting 24 m broad room with 150 cm wide carpet at Rs.16 per metre is Rs.3840.

  Polar coordinates and area of circle

In polar coordinates, write equations for the line x=1 and the circle of radius 2 centered at the origin. Write an integral in polar coordinates representing the area of the region to the right of x=1 and inside the circle.

  What is the length of the original side of the square

sides of a square are lengthened by 6cm the area becomes 225cm^2 what is the length of the original side of the square.

  Plot graphs of following functions

Refer to the graph given below and identify the graph that represents the corresponding function. Justify your answer.

  What are the lengths of the legs

a city park is shaped like a right triangle with length of one leg twice the length of the other leg. The area is 2500 m2. What are the lengths of the legs?

  How many tickets will be sold at $10 per ticket

Your Solution concert promoter expects to sell 35,000 - 1500p tickets to a concert, where "p" represents the price of a single ticket.

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