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
Mars2501 [29]
3 years ago
7

(1) Prompt the user to enter five numbers, being five people's weights. Store the numbers in an array of doubles. Output the arr

ay's numbers on one line, each number followed by one space. (2 pts) Ex: Enter weight 1: 236.0 Enter weight 2: 89.5 Enter weight 3: 142.0 Enter weight 4: 166.3 Enter weight 5: 93.0 You entered: 236.0 89.5 142.0 166.3 93.0 (2) Also output the total weight, by summing the array's elements. (1 pt) (3) Also output the average of the array's elements. (1 pt) (4) Also output the max array element. (2 pts) Ex: Enter weight 1: 236.0 Enter weight 2: 89.5 Enter weight 3: 142.0 Enter weight 4: 166.3 Enter weight 5: 93.0 You entered: 236.0 89.5 142.0 166.3 93.0 Total weight: 726.8 Average weight: 145.35999999999999 Max weight: 236.0
Computers and Technology
1 answer:
Mashutka [201]3 years ago
6 0

Answer:

weights = []

total = 0

max = 0

for i in range(5):

   weight = float(input("Enter weight " + str(i+1) + ": "))

   weights.append(weight)

   total += weights[i]

   if weights[i] > max:

       max = weights[i]

average = total / 5

print("Your entered: " + str(weights))

print("Total weight: " + str(total))

print("Average weight: " + str(average))

print("Max weight: " + str(max))

Explanation:

Initialize the variables

Create a for loop that iterates 5 times

Get the values from the user

Put them inside the array

Calculate the total by adding each value to the total

Calculate the max value by comparing each value

When the loop is done, find the average - divide the total by 5

Print the results

You might be interested in
A cycle merchant allows 15% discount on the marked price of a bicycle and still he makes a profit
lions [1.4K]

Answer:

The program in Java is as follows:

public class Main{

public static void main(String[] args) {

 double discount_percent = 0.15;

 double discount_amount = 600;

 double profit = 0.20;

 double marked_price = discount_amount/discount_percent;

 double cost_price = marked_price/(1 + profit);

 System.out.println("Marked Price: "+marked_price);

 System.out.println("Cost Price: "+cost_price);

}}

Explanation:

For explanation purpose, let

MP \to Marked Price

\%D \to Percentage discount

D \to Discounted amount

\%P \to Percentage Profit

C \to Cost Price

The marked price (i.e. selling price) is calculated discount using:

MP = \frac{D}{\%D}

The derived formula of the cost price from percentage profit and Marked Price is:

C = \frac{M}{1 + \%P * 100}

So, the explanation is as follows:

The next three lines declare and initialize the given parameters

<em>  double discount_percent = 0.15;</em>

<em>  double discount_amount = 600;</em>

<em>  double profit = 0.20;</em>

Calculate marked price

 double marked_price = discount_amount/discount_percent;

Calculate cost price

 double cost_price = marked_price/(1 + profit);

Print marked price

 System.out.println("Marked Price: "+marked_price);

Print Cost price

 System.out.println("Cost Price: "+cost_price);

3 0
2 years ago
Choose the answer. Janice's IT department found that her computer had a program on it that was collecting her personal informati
harkovskaia [24]

Answer:

Spyware

Spam is just unwanted soliciation, spoofing is making links appear as something else, pharming is creating a fake website for victims to use.

7 0
2 years ago
Gps has fostered many benefits in our society, but have also added some risks. What is a risk of gps?
kozerog [31]

GPS is a global positioning system that tells direction and routes. Some risks that come along with GPS are inaccuracy, distraction, and lack of knowledge.

<h3>What is GPS?</h3>

GPS is a radio navigation system based on the satellite and is used to navigate the directions with the help of the signals. Though it has many benefits also has disadvantages. It sometimes does not show accurate routes and direction that is too long.

The navigation system causes distraction during driving and may cause an accident. Too much reliance on GPS causes a lack of knowledge in remembering the directions and places. It may sometimes lead to crime as the saved information and be leaked.

Therefore, GPS has advantages and disadvantages too.

Learn more about GPS here:

brainly.com/question/6905079

#SPJ4

5 0
2 years ago
0111101101010110101110110001001011101001011101101010101010110101
rodikova [14]

Answer:

binary digits in computer system it belongs

4 0
3 years ago
When data are entered into a form and saved, they are placed in the underlying database as knowledge?
luda_lava [24]
The answer would be and is true.
7 0
3 years ago
Other questions:
  • Suppose a retailer who has no technology expertise wishes to set up an online presence for his business. He ________. a. ​can us
    6·1 answer
  • In a database, __________ is used to uniquely identify each record for retrieval or manipulation. answer an attribute or a field
    7·1 answer
  • 14. What is the simplest way to permanently get rid of an unwanted file?
    9·1 answer
  • Implement a recursive program that takes in a number and finds the square of that number through addition. For example if the nu
    5·1 answer
  • (PYTHON) Write a program that uses this technique to read a CSV file such as the one given above. Display the IDs and names of t
    14·1 answer
  • How are IP addresses usually written?
    7·1 answer
  • To check if your operating system is up to date, click Start then click Control Panel and choose _______________. Select one: a.
    11·1 answer
  • ساعدوني على الإجابة على هذه الأسئلة
    11·1 answer
  • Organizations following Waterfall methodology usually begin with requirements gathering, in which the development team attempts
    14·1 answer
  • What do other people think of e.t ( be specifc by putting a line in the story)<br><br> E.T MOVIE
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!