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

  Recursive factorial program

Write a class Array that encapsulates an array and provides bounds-checked access. Create a recursive factorial program that prompts the user for an integer N and writes out a series of equations representing the calculation of N!.

  Hunt the wumpus game

Reprot on Hunt the Wumpus Game has Source Code listing, screen captures and UML design here and also, may include Javadoc source here.

  Create a gui interface

Create GUI Interface in java programing with these function: Sort by last name and print all employees info, Sort by job title and print all employees info, Sort by weekly salary and print all employees info, search by job title and print that emp..

  Plot pois on a graph

Write a JAVA program that would get the locations of all the POIs from the file and plot them on a map.

  Write a university grading system in java

University grading system maintains number of tables to store, retrieve and manipulate student marks. Write a JAVA program that would simulate a number of cars.

  Wolves and sheep: design a game

This project is designed a game in java. you choose whether you'd like to write a wolf or a sheep agent. Then, you are assigned to either a "sheep" or a "wolf" team.

  Build a graphical user interface for displaying the image

Build a graphical user interface for displaying the image groups (= cluster) in JMJRST. Design and implement using a Swing interface.

  Determine the day of the week for new year''s day

This assignment contains a java project. Project evaluates the day of the week for New Year's Day.

  Write a java windowed application

Write a Java windowed application to do online quiz on general knowledge and the application also displays the quiz result.

  Input pairs of natural numbers

Java program to input pairs of natural numbers.

  Create classes implement java interface

Interface that contains a generic type. Create two classes that implement this interface.

  Java class, array, link list , generic class

These 14 questions covers java class, Array, link list , generic class.

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