Round the average score to one decimal

Assignment Help JAVA Programming
Reference no: EM13941515

The number format in one decimal place to make this to round the average score to one decimal in this program.

////////////////////////////////////////////////

import java.util.Scanner;

public class TestScoreApp
{
public static void main(String[] args)
{
// 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 <= 100)
{
// 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;
}
}

// 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: EM13941515

Questions Cloud

Find of significant value in helping understanding concepts : How has your perspective about the different types of early juvenile institutions changed during these years? How have your impressions of the core components of the early juvenile institutions changed since the beginning of the week?
The annuitys first payment occurs six years : What is the value today of a 15-year annuity that pays $580 a year? The annuity’s first payment occurs six years from today. The annual interest rate is 10 percent for Years 1 through 5, and 12 percent thereafter.
Business or business to consumer sectors : Select a small firm 'START UP' of your choice in the business to business or business to consumer sectors' and present it as a case study in the form of a written report in the form of a business plan. Cover the nature of the business start-up, th..
How much overhead cost is allocated : How much overhead cost is allocated to the Supervising activity cost pool under activity-based costing?
Round the average score to one decimal : The number format in one decimal place to make this to round the average score to one decimal in this program.
A car is traveling at 70 kmh it then uniformly decelerates : A car is traveling at 70 km/h. it then uniformly decelerates to a complete stop in 12 seconds. Find its acceleration (in m/s2)
What is the variance and expected return of the portfolio : Consider the following information: Rate of Return if State Occurs State of Probability of Economy State of Economy Stock A Stock B Stock C Boom 0.15 0.40 0.50 0.30 Good 0.60 0.16 0.10 0.09 Poor 0.20 − 0.02 − 0.05 − 0.03 Bust 0.05 − 0.18 − 0.25 − 0.1..
Thorough review of the extant literature : Investigate and prepare a detailed, yet succinct report, which demonstrates a thorough review of the extant literature. It should identify and assess the key contributions by scholars in that topic.
What are the articles of confederation and the constitution : Draw a conclusion about the ideals stated in the Declaration. Are they still pertinent? Which has the greater ability to accomplish them- - a distant national government funded by all Americans, or a closer state government, responsive to its popu..

Reviews

Write a Review

JAVA Programming Questions & Answers

  The program reads in names

Write a program and include the following methods. The program reads in names and ages (use 2 parallel arrays, maximum size 50) from a file called Stuff.dat.

  Write an application that uses an array

Write an application that uses an Array to store 10 messages of type String. You can load this data structure with 10 messages of your choosing.

  Write a program that takes input of names from user

Write a program that takes input of names from user. Print total names number and all names. NOTE: Solve this problem using ArrayList and Enhanced For Loop. Typical run of the program:Enter a name: (Q to exit)

  Use of width and height attributes in an element

Which of the following will occur if you do not use the width and height attributes in an element?

  Constructs a rectangle object

Write an AreaTester program that constructs a Rectangle object and then computes and prints its area. Use the getWidth and getHeight methods. Also print the unexpected answer.

  Write a class that reads a file

In java, write a class that reads a file and outputs a list of the unique words in the file and the number of times each unique word occurs.Hint: use a HashMap with keys being the words and values being integer counts associated with the words.

  Using the java development kit and jgrasp

Using the Java Development Kit and jGrasp, develop a program in response to the following prompt:

  Writing an applet with graphics in this programming

writing an applet with graphics in this programming activity you will write an applet that uses graphics. you will draw

  Write a program that creates an apartment object and prompts

Create a structure named Apartment that contains data fields to hold the number of bedrooms, the number of bathrooms, and the monthly rent for the apartment.

  Use counting sort to sort an array

State the difficulty in attempting to use counting sort to sort an array of n floating-point numbers from the continuous interval [0,1].

  Which is the best character high value

When updating a master file with data from a transaction file, what should happen for an addition record when a match is found in the master file?

  Practice using recursion with data structures

Write a recursive method in this class called hasSameStructureAs(BinaryTree tree) that returns whether or not a tree has the same structure as another tree.

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