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
KengaRu [80]
3 years ago
9

Create a new Java project/class called Examine1. Prompt user as to how many numbers they would like to enter. Use a cumulative s

um loop to read in and sum that many numbers. Once all numbers entered, program should print out the sum total and average of those numbers entered by the user. Use the printf command to format. Paste code.
Computers and Technology
1 answer:
Zinaida [17]3 years ago
8 0

Answer:

Explanation:

The following code is written in Java and like requested prompts the user for a number to continue or a letter to exit. Then loops and keeps adding all of the numbers to the sum variable and adding 1 to the count for each number entered. Finally, it prints the sum and the average using printf and the variables.

import java.util.Scanner;

class Examine1 {

   public static void main(String[] args) {

       Scanner in = new Scanner(System.in);

       int sum = 0;

       int count = 0;

       System.out.println("Enter a number to continue or a letter to exit.");

       while(in.hasNextInt()) {

           System.out.println("Enter a number:");

           sum += in.nextInt();

           count += 1;

       }

       System.out.printf("The sum is %s.%n", sum);

       System.out.printf("The average is %s.", (sum / count));

   }

}

You might be interested in
In a linux script, the line ____ is important because it identifies the file as a script.
igor_vitrenko [27]
The closest line to that would be the first line:


#!/bin/bash

echo "Hello World!"


BTW, the "#!" is referred to as a she-bang. When those are the first characters executed, the (requires an absolute path) program that follows is launched, and the rest of this file is given to it as data. To run this like a program, the execute permissions need to be set ( chmod 0755 script.sh ).
8 0
3 years ago
Complete the code to finish this program to analyze the inventory for a store that sells purses and backpacks.
sp2606 [1]

Answer:

import csv

fileIn = open("data/bags.txt","r")

countPurse = 0

textFile= csv.reader(fileIn)

for bag in textFile:    

   if bag[ 1 ] == 'purse':

       countPurse = countPurse + int(bag[6])

fileIn.close()

print("Number of purses:",countPurse)

Explanation:

I hope this helps!

3 0
3 years ago
Describe the role of a distributed file system in a job execution environment such as MapReduce in a large-scale cloud system. g
Bezzdna [24]

Answer:

allows users of physically distributed systems to share their data and resources

Explanation:

The main purpose of the Distributed File System (DFS) is to allows users of physically distributed systems to share their data and resources

6 0
2 years ago
What's the function of a cyclebin​
amid [387]

Answer:

In Windows, the Recycle Bin is a folder or directory where deleted items are temporarily stored. Deleted files are not permanently removed from the hard drive but are sent instead to the Recycle Bin, unless they are too large.

3 0
3 years ago
Please help me ASAP!
VARVARA [1.3K]

Answer:

security hacker

Explanation:

security hackers are people who hack software to check for vulnerabilities. most of the time security hackers are white hat hackers who work to perform penetration tests to see if a software is secure.

tell me if this is wrong :)

6 0
3 years ago
Read 2 more answers
Other questions:
  • In databases and database-related software, which choice is not a Boolean operator?
    7·2 answers
  • What is the speed limit in school zone
    11·2 answers
  • List five characteristics of a series circuit
    9·1 answer
  • In many cases, a subquery can be restated as a/an ______________.
    13·1 answer
  • Packet ________ is a form of protection for your computer that looks at each packet that comes into your computer network. scree
    15·1 answer
  • Will a pair of bar magnet ,with keepers on the two ends, act as a magnet
    13·1 answer
  • ___ is a family of data formats that helps people automatically receive feeds anytime there are new postings to their favorite b
    14·1 answer
  • Which spreadsheet toolbar displays options such as Cut and Paste?
    11·2 answers
  • Is data science the sexiest job in 21st century according to Harvard business review?
    13·1 answer
  • What causes the hidden node problem in a wireless local area network (wlan)?
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!