Modify testscoreappmath

Assignment Help Basic Computer Science
Reference no: EM13761540

Modify TestScoreAppMath 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: EM13761540

Questions Cloud

Write an essay on love philosophy and shakespeare : Write a 1500 words essay on Love, philosophy, shakespeare.
Modify the test score application : Modify the Test Score application so that it uses Big Decimal arithmetic to calculate the average test score with result rounded to 1 decimal place. Note that because the scoreCount and scoreTotal are int, you don't have to create the Big Decimal ..
Identify role of political economy in international trade : Identify the role of the political economy in international trade; how do these roles affect the US and Mexico? Use scholarly articles to support your stance.
Cost per output and cost per outcome response : A human service agency did not determine the cost per output and cost per outcome.
Modify testscoreappmath : Use the += operator to increase the scoreCount and scoreTotal variables. Then test this to makes sure it works.
Partnership and corporate tax returns : Use the partnership and corporate tax returns for the practice sets titled, "Pet Kingdom" and "ROCK the Ages, LLC" that you prepared in Weeks 3 and 5 in order to complete this assignment.
Write a paper about communicative competence for parents : Write a paper about communicative competence for parents and teachers of young children. explain why it is important for children to acquire.
Supply and demand from the simulation : How may you apply what you learned about supply and demand from the simulation to your workplace or your understanding of a real-world product with which you are familiar?
Compare and contrast the different iss policies : Describe the different ISS policies associated with risk management. Compare and contrast the different ISS policies associated with incident response teams (IRT).

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Implement the class with accessors and mutators

Implement the class with accessors and mutators for the movie name and MPAA rating. Write a method addRating that takes an integer as an input parameter.

  How the pages hold style continuity in grid system

Export the finished article as PDF format AND also give me the original indesign file, and the fonts you used.

  Explain and justify the need for good hcr practice

Demonstrate an alternative screen design for a user with a visual impairment beyond the usability level appropriate for your main design. What would you do to make your app accessible for them?

  What u think about the article database fight funding cuts

What u think about the article Database fight funding cuts

  Web design and development

Identify the primary responsibilities associated with each of the following Web design roles: content writer/editor, artist/graphic designer, Web page designer, Web programmer/database developer, and content manager.

  Why is it important to educate users about risks

what is a primary security risk that users should acknowledge when using macros? Why is it important to educate users of these risks once their dilemma is resolved?

  Decide which of the following identifier forms

Decide which of the following identifier forms is most readable, and then support the decision. SumOfSales Sum_of_sales SUMOFSALES

  Explaining gui differences and security differences

With that being said, its great that each of you pointed out the GUI differences. What about the Security differences?

  Determine the delays of the carry out

Determine the delays of the carry out bit c48 and the gate complexity, i.e, the numbers of AND, OR and XOR gates needed for implementing the following 48-bit adders.

  Discuss whether a rebalance operation is required or not

Consider an AVL tree with 9 nodes containing positive integer values in of your own from the interval 1 .. 99.

  How digital media has been used to influence

How digital media has been used to influence

  A deck of playing cards in a card game

A deck of playing cards in a card game where cards may be drawn from, or discarded to, either the top or the bottom of the deck, but no access to cards in the middle of the deck is permitted.

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