1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
VladimirAG [237]
3 years ago
12

SummaryIn this lab, you complete a partially prewritten Java program that uses an array.The program prompts the user to interact

ively enter eight batting averages, which the program stores in an array. The program should then find the minimum and maximum batting average stored in the array as well as the average of the eight batting averages. The data file provided for this lab includes the input statement and some variable declarations. Comments are included in the file to help you write the remainder of the program.Instructions1.Ensure the file named BattingAverage.java is open.Write the Java statements as indicated by the comments.Execute the program by clicking "Run Code." Enter the following batting averages: .299, .157, .242, .203, .198, .333, .270, .190. The minimum batting average should be .157, and the maximum batting average should be .333. The average should be .2365.import java.util.Scanner;public class BattingAverage{public static void main(String args[]){Scanner s = new Scanner(System.in);// Declare a named constant for array size here.// Declare array here.// Use this integer variable as your loop index.int loopIndex;// Use this variable to store the batting average input by user.double battingAverage;// String version of batting average input by user.String averageString;// Use these variables to store the minimim and maximum batting averages.double min, max;// Use these variables to store the total and the average.double total, average;// Write a loop to get batting averages from user and assign to array.System.out.println("Enter a batting average: ");averageString = s.nextLine();battingAverage = Double.parseDouble(averageString);// Assign value to array.// Assign the first element in the array to be the minimum and the maximum.min = averages[0];max = averages[0];// Start out your total with the value of the first element in the array.total = averages[0];// Write a loop here to access array values starting with averages[1]// Within the loop test for minimum and maximum batting averages.// Also accumulate a total of all batting averages.// Calculate the average of the 8 averages.// Print the averages stored in the averages array.// Print the maximum batting average, minimum batting average, and average batting average.System.exit(0);}{
Computers and Technology
1 answer:
Andrej [43]3 years ago
8 0

Answer:

The complete program is as follows:

import java.util.Scanner;

public class Main{

   public static void main(String args[]){

       Scanner s = new Scanner(System.in);

       final int lent = 8;

       Double averages[] = new Double[lent];

       int loopIndex;

       double battingAverage;

       String averageString;

       double min, max;

       double total, average;

       for(loopIndex = 0;loopIndex<lent;loopIndex++){

       System.out.print("Enter a batting average: ");

       averageString = s.nextLine();

       battingAverage = Double.parseDouble(averageString);

       averages[loopIndex] = battingAverage;        }

       min = averages[0];max = averages[0];

       total = averages[0];

       for(loopIndex = 1;loopIndex<lent;loopIndex++){

       if(averages[loopIndex]>=max){

           max = averages[loopIndex];        }

       if(averages[loopIndex]<=min){

           min = averages[loopIndex];        }

       total+=averages[loopIndex];        }

       battingAverage = total/8;

       for(loopIndex = 0;loopIndex<lent;loopIndex++){

       System.out.println(averages[loopIndex]+" ");        }

       System.out.println("Average: "+battingAverage);

       System.out.println("Minimum: "+min);

       System.out.println("Maximum: "+max);

       System.exit(0);

       }}

Explanation:

See attachment for complete program with comments

Download txt
You might be interested in
The component that allows you to make a paper-based copy of a body of text is the _____.
ANTONII [103]
The correct answer is: Scanner

The scanner is a piece of technology which unlike the printer is an input device which basically scans the top-view of any flat surface (usually paper but is definitely not limited to it) introduced in its effective range using light. The data scanned is then transfered to the Central Processing Unit for futher processing. The processed image can then be outputted and seen on the monitor's display. Once available for printing, the Central Processing Unit will just send the processed image into the printer ad voila, your scanned image is now printed in a piece of paper!

Today, scanners come with printers as a bundle. It is a perfect combination since the printer will just print the image anyway.
5 0
3 years ago
The first tools that analyzed and extracted data from floppy disks and hard disks were MS-DOS tools for ____ PC file systems.
netineya [11]

<u>The first tools that analyzed and extracted data from floppy disks and hard disks were MS-DOS tools for </u><u>IBM</u><u> PC file systems</u>. A file system is a structured representation of data and a set of metadata describing this data. The file system of the IBM supports stream input/output and storage management, providing a structure over all information stored in the system. A floppy disk consists of a thin plastic disk coated with magnetic material (it was designed by IBM in the early 1970s). A hard disk is fixed on the system unit. It is made up of several circular disks called platters. MS-DOS (Microsoft Disk Operating System) is a licensed operating system for use on microcomputers from various manufacturers.

6 0
3 years ago
Http://www.alegrium.com/sgi/2/eibder
Flura [38]

Answer:

so what is this uhhhhhhhhhh

7 0
2 years ago
Viruses and Malware Complete the case project on page 82 of the textbook by researching two types of viruses, two types of malwa
Naddika [18.5K]

Hi, I provided you a general guide on how to go about your writing your research paper.

<u>Explanation:</u>

Note, the current APA (American Psychological Association) format is the <em>APA 7th Edition. </em>This format details how a researcher should state the findings, sources, conclusion, etc.

Hence, you can begin writing the assigned paper only after gathering the needed data.

6 0
3 years ago
Compare the elements of the basic Software Development Life Cycle with 2 other models. How are they similar? How are they differ
Artemon [7]

Answer:

Explanation:

One of the basic notions of the software development process is SDLC models which stands for Software Development Life Cycle models. SDLC – is a continuous process, which starts from the moment, when it’s made a decision to launch the project, and it ends at the moment of its full remove from the exploitation. There is no one single SDLC model. They are divided into main groups, each with its features and weaknesses. The most used, popular and important SDLC models are given below:

1. Waterfall model

2. Iterative model

3. Spiral model

4. V-shaped model

5. Agile model

Stage 1. Planning and requirement analysis

Each software development life cycle model starts with the analysis, in which the stakeholders of the process discuss the requirements for the final product.

Stage 2. Designing project architecture

At the second phase of the software development life cycle, the developers are actually designing the architecture. All the different technical questions that may appear on this stage are discussed by all the stakeholders, including the customer.  

Stage 3. Development and programming

After the requirements approved, the process goes to the next stage – actual development. Programmers start here with the source code writing while keeping in mind previously defined requirements. The programming by itself assumes four stages

• Algorithm development

• Source code writing

• Compilation

• Testing and debugging

Stage 4. Testing

The testing phase includes the debugging process. All the code flaws missed during the development are detected here, documented, and passed back to the developers to fix.  

Stage 5. Deployment

When the program is finalized and has no critical issues – it is time to launch it for the end users.  

SDLC MODELS

Waterfall – is a cascade SDLC model, in which development process looks like the flow, moving step by step through the phases of analysis, projecting, realization, testing, implementation, and support. This SDLC model includes gradual execution of every stage completely. This process is strictly documented and predefined with features expected to every phase of this software development life cycle model.

ADVANTAGES  

Simple to use and understand

DISADVANTAGES

The software is ready only after the last stage is over

ADVANTAGES

Management simplicity thanks to its rigidity: every phase has a defined result and process review

DISADVANTAGES

High risks and uncertainty

Iterative SDLC Model

The Iterative SDLC model does not need the full list of requirements before the project starts. The development process may start with the requirements to the functional part, which can be expanded later.  

ADVANTAGES                                        

Some functions can be quickly be developed at the beginning of the development lifecycle

DISADVANTAGES

Iterative model requires more resources than the waterfall model

The paralleled development can be applied Constant management is required

Spiral SDLC Model

Spiral model – is SDLC model, which combines architecture and prototyping by stages. It is a combination of the Iterative and Waterfall SDLC models with the significant accent on the risk analysis.

4 0
2 years ago
Other questions:
  • When did Kodak introduce film photography to the commercial market?
    10·2 answers
  • You should use html elements instead of server controls when
    11·1 answer
  • The command to delete all the files that have filenames that starts with letter c or c and ends with a letter z or z is
    15·1 answer
  • When Clara accesses the programs and documents on her computer by way of icons, she is said to be employing
    15·1 answer
  • Write a program in Python that reads in investment amount, annual interest rate, and number of years, and displays the future in
    6·1 answer
  • Get two positive integers from the user. Write code to multiply the two numbers together using only addition or subtraction. You
    12·1 answer
  • Assume the availability of a function named oneMore. This function receives an integer and returns one more than its parameter.
    14·1 answer
  • 5.During a recent network attack, a hacker used rainbow tables to guess network passwords. Which type of attack occurred
    9·1 answer
  • An alternative to configuring individual workstations is to establish configurations dynamically when the computers connect to t
    7·1 answer
  • When solving a problem in a group situation, which of the following traits should be demonstrated?
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!