JAVA
Write a program that will input a list of test scores in from the keyboard. When the user enters -1, print the average.
What do you need to be careful about when using-1 to stop a loop?
Sample Run:
Enter the Scores:
45
100
-1
The average is: 72.5

Answers

Answer 1

import java.util.Scanner;

public class JavaApplication35 {

   public static void main(String[] args) {

       Scanner scan = new Scanner(System.in);

       System.out.println("Enter the Scores:");

       int total = 0;

       int count = 0;

       while (true){

           int num = scan.nextInt();

           if (num == -1){

               break;

           }

           else{

               total += num;

               count += 1;

           }

       }

       System.out.println("The average is: "+((double)total/count));

   }

   

}

I hope this helps!


Related Questions

Write three statements to print the first three elements of vector runTimes. Follow each with a newline. Ex: If runTimes = {800, 775, 790, 805, 808}, print:

Answers

Answer:

Following are the code to this question:

#include <stdio.h>//defining header file

int main()//defining main method

{

   int runTimes[] = {800, 775, 790, 805, 808};//defining array of integers

   for(int k=0;k<3;k++)//defining for loop for print value

   {

       printf("%d\n",runTimes[k]);//print value with a new line

   }

   return 0;

}

Output:

800

775

790

Explanation:

In the above-given C language code, an array "runTimes" is defined, which holds the number of integer values.

In the next step, a for loop is defined, which uses the "k" variable, which starts from 0 and ends when its value is less than 3.

In the for loop, it uses the print method with "\n", that prints the array value in the new line.

Question #3
Multiple Select
Which statements are true about a user-defined data type? Select 3 options.
It can only include one data type.
I
It can include bool data.
It cannot be changed once you define it.
It can include string data.
O It can include numeric data,

Answers

An attribute of a piece of data known as a “data type” instructs a computer system how to interpret that data's value.

What are the different type data type and their uses?

Data is categorized into different types by a data type, which informs the compiler or interpreter of the programmer's intended usage of the data.

Most computer languages provide a variety of data types, including integer, real, character or string, and Boolean.

The operations that can be performed to create, alter, and use the variable in another calculation without running the risk are specified by the data type.

Knowing the various types of data makes it easier to make sure that the values of each property are as expected and that the data is gathered in the right format.

A programming language is said to be strongly typed if it only permits operations on variables that respect their data type.

Therefore, It can include string data, bool data, numeric data.

Learn more about data type here:

https://brainly.com/question/14581918

#SPJ2

Answer:

A D E

Explanation:

Sam is developing a software program in Python and has a question about how to implement a particular feature. Which use of a resource is most likely to provide Sam with the best results?

A) joining a Python developer forum and posting a question to the forum to solicit feedback
B) joining a Python developer forum and following links to technical news sites
C) reviewing an Introduction to Computer Science textbook
D) reviewing the computer user manual

Answers

Answer:

A or D

Explanation:

i could be wrong

Answer:

probably A, i mean it makes the most sense cause why review a computer user manual? C is an introduction so I doubt that's the level of question he is asking about. B is a no when it states "News sites", I honestly don't think there is any news sites that would help in any way.

Electronic type is often considered to be the latest step in the evolution of the written ______________.


A
papers

B
word

C
people

Answers

It isn’t people but im really confused. I think its A but dont come at me if its wrong

How do you create multiple columns in Word?

A.Click Home>Paragraph, Alignment



B.Click Page Layout > Columns, Click the column layout you want



C.Select the text or click in the section you want to change, Click Page Layout > Columns, Click the column layout you want.

Answers

Answer:

I think it's B

Explanation:

it sounded right to me.

Employing the use of a(n)
will help you manage a STEM project.

Answers

Answer:

technicians

Explanation:

the answer is technicians. in my freshmen year we made flash cards and i still have them so i remember it.

Answer: technicians

Explanation:

my teacher told me and I passed so its right

WILL GIVE BRAINLIEST!!!!!!!

In MECHANICAL systems, we use valves to control where the flow of the liquid goes


True


False

Answers

The answer is true !!!

When locating and correcting accessibility issues for a document, you would click what first?

A.Insert
B.View
C.Home
D.File

Answers

A:insert (hope you have a great day) pls mark as brainliest!!

_____________________________________________________is a pre-designed format to help users with the creation of a document, like a flyer, brochures, or resumes. Fill the blank/ what's the answer?

A.PowerPoint
B,Excel
C.Template
D.Pie Chart

Answers

C template......................................

There is a feature that allows you to lock the document, to avoid others making changes. t/f

Answers

Answer:

true

Explanation:

i have the same class

Answer:true

Explanation:

I took the test and it was correct

Cars are only as safe as their driver, so __ is your bet to lower your risk.

Answers

seatbelt

Explanation:

Seatbelt lowers your momentum so it can take impact to be less dangerous

Cryptography has requirements include:

A. easy to compute and not invertible
B. tamper-resistant
C. collision-resistant
D. All the above

Answers

Answer:

A

Explanation:

Cryptography is the study of secure communications techniques that allow only the sender and intended recipient of a message to view its contents. ... When transmitting electronic data, the most common use of cryptography is to encrypt and decrypt email and other plain-text messages.

Notice that the word rushes is bolded in the passage.
Based on the text, what can be inferred about rushes?
O Rushes are a type of shady tree.
O Rushes are a type of fish.
O Rushes are a type of water plant.
Rushes are a type of hedge or bush.

Answers

Answer:

Rushes are a type of water plant.

Explanation:

Answer:

Its C

Explanation:

Uploading Your Work
Assignment Upload: Using PowerPoint
Active
Instructions
Click the links to open the resources below. These resources will help you complete the assignment. Once you have created your
file(s) and are ready to upload your assignment, click the Add Files button below and select each file from your desktop or network
folder. Upload each file separately.
Your work will not be submitted to your teacher until you click Submit.
Documents
Uploading Your Work Directions
Clip Art and Media Clips Student Guide
Animations and Photo Albums Student Guide
Customizing SmartArt Graphics and Tables Student Guide

Don’t know how to do this and could really use some help please!!!!!!!

Answers

Answer:

Easy all you have to do is upload one assignment at a time and follow all the other directions!

Explanation:

_Hope_this_helps! >O<

There are built-in Styles to format your document and make changes to your document with just one click of a button.
True
or
False

Answers

False

i’m sure of it !!

Answer:true

Explanation:

I took the test it was correct

What is the initial step that an information security manager would take during the requirements gathering phase of an IT project to avoid project failure?

Answers

Answer:

Ensure that the business problem is clearly understood before working on the solution.

Explanation:

To avoid project failure, the initial step in the requirement gathering phase of an IT project is the basic understanding of the real and actual motivation that is behind what is required.

A good and concise understanding of the problem is needed first before a solution can be offered to this problem. If the business problem is unknown or not understood then the project would likely end up as a failure because the solution offered may not be the right one.

A _ shows the end of a page . ​

Answers

Answer:

page break shows the end of a page.

Answer:

what is your question??

Explanation:

1. Distinguish between
a) Optical and Magnetic scanning
(2marks)
Optical scanning
1.They use principles of light to scan document
Magnetic scanning
1. They use principles of magnetism to
document
sense

Answers

Answer:

They use principles of light to scan document

Magnetic scanning

Explanation:

Think about the five steps to writing an algorithm. Why is each step necessary?

Answers

Answer:

There are many ways to write an algorithm. Some are very informal, some are quite formal and mathematical in nature, and some are quite graphical. The instructions for connecting a DVD player to a television are an algorithm. A mathematical formula such as πR2 is a special case of an algorithm. The form is not particularly important as long as it provides a good way to describe and check the logic of the plan.

The development of an algorithm, a plan is a key step in solving a problem. Once we have an algorithm, we can translate it into a computer program in some programming language. Our algorithm development process consists of five major steps.

Explanation:

Step 1: Obtain a description of the problem.

Step 2: Analyze the problem.

Step 3: Develop a high-level algorithm.

Step 4: Refine the algorithm by adding more detail.

Step 5: Review the algorithm.

Choose the type of loop that works best for the situation. When you do not know ahead of time how many passes you will make through a loop, a(n) vloop is best. Such a loop uses​

Answers

Answer:

Indefinite loop;

while loop

Explanation:

Give me brainliest

Answer: 1.indefinite 2. while

Explanation:

7.4 Code Practice: Question 2
Adjust the code you wrote for the last problem to allow for weighted classes. Add a parameter weighted ( 1 = yes, 0 = no) and then return the correct number for the GPA. Weighted classes get one extra point on the GPA value.

I could really use some help on this and 7.5 (I’ll ask that question for 7.5 later)

Answers

def GPAcalc(grade, weighted):

   grade = grade.lower()

   dictionary = {"a": 4, "b": 3, "c": 2, "d": 1, "f": 0}

   if weighted == 1 and grade in dictionary:

       return "Your GPA score is: "+str(dictionary[grade] + 1)

   elif weighted == 0 and grade in dictionary:

       return "Your GPA score is : "+str(dictionary[grade])

   else:

       return "Invalid"

print(GPAcalc(input("Input a letter grade: "), int(input("Is it weigthed? (1= yes, 0= no)"))))

I modified the code a bit to cut down on the use of if and elif statements. If you need me to change it, I will. Best of luck.

The program is an illustration of conditional statements.

Conditional statements are statements whose execution is dependent on its truth value.

The program in Python, where comments are used to explain each line is as follows:

#This initializes the dictionary

dict = {"a": 4, "b": 3, "c": 2, "d": 1, "f": 0}

#This gets input for grade

grade = input().lower()

#This gets input for the weighted average

weighted = int(input())

#If the weighted average is 1, and the grade is in the dictionary

if weighted == 1 and grade in dictionary:

   #This prints the GPA score

   print("Your GPA score is: "+str(dict[grade] + 1))

#If the weighted average is 0, and the grade is in the dictionary

elif weighted == 0 and grade in dictionary:

   #This prints the GPA score

   print("Your GPA score is : "+str(dict[grade]))

#Otherwise

else:

   #The grade is invalid

   print("Invalid")

Read more about similar programs at:

https://brainly.com/question/19241597

What is the missing line of code?
>>> phrase = "You are amazing!"
>>>
'ar'
O phrase[4:6]
Ophrase[4:5]
O phrase[3:6)
O phrase[3:5]

HURRY !!!

Answers

Answer:

I belive the answer is, A. phrase[4:6]

Answer: Phrase 4:6

Explanation: got it right on edgen

Masons work with stone or brick true or false

Answers

Answer:

True

Explanation:

The common materials of masonry construction are brick, building stone such as marble, granite, and limestone, cast stone, concrete block, glass block, and adobe. Masonry is generally a highly durable form of construction.

What is a programming language?

Answers

d is the answer cause coding

Answer: it’s C

Explanation:

oops i meant A

Resources that doesn't go back to their normal state after being used are *​

Answers

Answer:

nonrenewable resources

Explanation:

There are primarily two types of resources: renewable and non-renewable. The main difference between the two is that the renewable resources can be replenished while the non-renewable resources cannot be replenished.

Examples of non-renewable resources: coal, oil and natural gas. These are called "fossil fuels." Although they only have a limited supply, most of our human activities are dependent on these fossil fuels, which threatens their depletion.

The Scrum team is Using Kanban board to make work Visibility available to all. What cannot visible? a) percentage Completion b) Task move from left to Right

Answers

Answer:

a) percentage Completion

Explanation:

A Kanban board is a digital panel divided into five columns where work teams can view a job until its execution and thus optimize the flow of completed jobs, in addition to allowing the full execution of tasks. These columns are named refers to each phase of the production of a job, as a phase is completed it is possible to move the job to the next column, which allows us to conclude that the use of this type of frame allows the movement of tasks from right to left, but does not allow you to see the percentage of completion.

How do you make someone the Brainliest?

Answers

You click brainliest

Answer:

When two people answer you can make someone Brainliest so don't be confused when you couldn't when one person answers.

Explanation:

I want Brainliest, lol.

in the validation rule LIKE" OZ" OR LIKE" 1b", what do the asterisks represent?

a specific number of letters
a specific number of digits
any number of characters
a single character
THE ANSWER IS C

Answers

c is the answer to the question of it

I want to get an output picture in python but it says this. I'm using turtle

Answers

What computer are you using maybe that’s the issue?

PLZ help

In three to five sentences, compare and contrast paraphrasing and summarizing.

Answers

Answer:

To put simply,paraphrasing refers to the conversion of the original or the concerned source material into the own or personal words of the reader or the interpreter.In contrast,summarizing mainly refers to the conversion of the main idea/s,concept/s or content of any original text or source material into the writer's or interpreter's own words.

Explanation:

Paraphrasing commonly engages putting any original text of any source material into the own words of the reader or the interpreter of the material.On the other hand,summarizing mainly involves converting the central idea/s or the content/s of the source material into the own words of the reader or interpreter of the source material.

Paraphrasing involves selection of any specific broader section or part of the source material and its conversion into a shorter version in terms of the own words of the reader or the interpreter,whereas,summarizing construes selection of the overall of main idea/s or content of the source material and putting it into a condensed form,expressed in the own words of the reader or interpreter.

Other Questions
Muslims believe that A) there are many godsB) they worship the same gods as Jews C) religion should be divorced from politics D) only by dying in jihad can heaven be obtained Based on the linear inequality shown in the graph below, which of the following points are solutions to the linear inequality? Select all that apply. A.(7, -5) B.(-2, 6) C.(-3, 0) D.(-1, -8) E. (4, 1) Rectangle A is dilated to form rectangle A'.Which figure shows the point that is the center of the dilation? Match the correct type of housing for each social class (group) during the 1900s.Column AColumn B1.Poora. Mansions in the suburbs2.Middleb. Lived just outside of the slums3.RichC. Tenement What is number 10?? Please help? Select the correct text in the passage.Which four phrases best describe the setting in this excerpt from James Joyce's "A Portrait of the Artist as a Young Man?When the 1. short days of winter. came dusk fell 2.before we had well eaten our dinners. When we met in the street the houses had grown sombre.3.The space of sky above us was the colour of ever-changing violet and towards it the lamps of the street lifted their feeble lanterns. 4.The cold airstung us and we played till our bodies glowed. Our shouts echoed in the silent streets. The career of our play brought us through 5.the darkmuddy lanes behind the houses where 6.we ran the gauntlet. of the rough tribes from the cottages, to the back doors of the dark drippinggardens where odours arose from the ashplts, 7.to the dark odorous stables 8.where a coachman smoothed and combed the horse or shook musicfrom the buckled harness. ayo i just wanted to say I CANT TRUST NONE OF YALL WHY YALL BE PUTTING THE WRONG ANSWERS 12. What is a metal on the periodic table? What is a nonmetal? (Relative to themetalloid staircase) Molly is painting her bedroom walls, and the paint costs $24 per gallon. How much does the paint cost per quart?$3 per quart$6 per quart$48 per quart$96 per quart Diego also adds 28 tablespoons of sugar. How many cups did he use?A.1 cup of sugar B. 1 1/2 cups of sugarC.1 3/4 cups of sugarD. 1 1/4 cups of sugar Search up Colombian exchange and look at some of the goods that are coming out of the new world and going to the old world? Suppose a particular brand of energy bars has come up with a new recipe. They want to know how many energy bars they need to test for calorie content in order to be 94% confident that the sample mean will be within 3 calories of the true mean schools/ teachers should give kids mental health days. after everything we go through, we deserve it. What did Patrick Henry of Virginia mean when hesaid "The next wind that sweeps from the north will bring to ourears the clash of weapons!"? Which of the following shows the result of -2 x -3 Can you guys help im kinda struggling 151. Oxygen is released during this process Far West Trading expects to pay an annual dividend of $1.75 per share next year. What is the anticipated dividend for Year 3 if the firm increases its dividend by 3 percent annually The scatterplot shows the relationship between icecream consumption and temperature.Based on the data, how many pints of ice cream willmost likely be consumed when it is 100F?Ice Cream Consumptionvs. TemperatureO less than 0.25 pintsO greater than 0.55 pintsO about 0.35 pintsO about 0.45 pints0.550.45Pints Consumedper Person0.350.2520304050607080Temperature (F) The inflation rate over the past year was 3.7 percent. If an investment had a real return of 9.2 percent, what was the nominal return on the investment?