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
Amanda [17]
3 years ago
6

Modify the provided code file to create a workout tracking program that lets the user enter (from the console) the distance they

ran each day of the week. Store each value into an array of doubles named distances
Computers and Technology
1 answer:
koban [17]3 years ago
3 0

Answer:

  1. import java.util.Arrays;
  2. import java.util.Scanner;
  3. public class Main {
  4.    public static void main(String[] args) {
  5.        Scanner input = new Scanner(System.in);
  6.        double distances [] = new double[7];
  7.        for(int i=0; i < distances.length; i++){
  8.            System.out.print("Input running distance for day " + (i+1) + ": ");
  9.            distances[i] = input.nextDouble();
  10.        }
  11.        System.out.println(Arrays.toString(distances));
  12.    }
  13. }

Explanation:

The solution code is written in Java.

Firstly, create a Scanner object to get user input for running distance (Line 6). Next, declare a distances array and set the array size to 7 because we intend to use this array to hold running distance for 7 days per week.

Next, use the for loop that run for 7 times to repeatedly prompt user to input running distance for each day and store each value to the array distances (Line 9 -12).

At last, display the array to console terminal (Line 14).

You might be interested in
Write a function (subroutine) that inputs a data value in register r0 and returns value in r0. The function returns y 5 a 1 bx 1
umka2103 [35]

Solution :

  int f(int x){

      \text{return a + b*x +c*x*x};

  }*/

  int f(\text{int R0}){

      int stack[2] = {\text{R1,R2}};

      \text{R1 = R0};

      \text{R1 = R1}\times \text{ R1};

      \text{R2 = C};

      R1 = R1 * C; /*R1 = cx^2*/

      \text{R2 = B};

      \text{R0 = R0} * R2; /* R0 = bx */

      \text{R0 = R0 + R1}; /*R0 = bx + cx^2 */

      \text{R2 = C};

      \text{R0 = R0 + R2}; /*R0 = a+bx+cx^2 */

      \text{R1 = stack[0];}

     \text{ R2 = stack[1];}

     \text{ return R0;}

  }

  /*\text{ARM code to implement the following C operation}

  int s=0;

  \text{for ( i = 0; i < 10; i++)}

  { \text{s = s + i } \times i;)

  */

          AREA SumSquares, code, readWrite

          ENTRY

          \text{MOV r0, #0}        ;loop \text{ counter i present at 0}

          MOV r1, #0       ; s = 0

  Loop   \text{MUL r2, r0, r0}   ;calculate i*i

          \text{ADD r1, r1, r2}   ;s = s+ i*i

          \text{ADDS r0, r0}, #1   ; i = i+1

          \text{CMP r0},#10       ; test for end

          \text{BNE} Loop        ; \text{continue until all added}

          END

5 0
3 years ago
What plan can businesses use to protect sensitive data from malicious attacks?
Anna11 [10]

Answer:

cybersecurity

Explanation:

it's either that or anti-spywhare but cybersecurity seems more likely

6 0
3 years ago
Read 2 more answers
Despite the rise of messaging apps and other forms of social media, these efforts are focused on consumer efforts, with corporat
miss Akunina [59]

Answer:

False

Explanation:

In our current market, we can find some messaging apps and social media designed for corporation organization setting. One example of messaging apps widely used in corporate world is Slack. The Slack enable user to set up different communication channel with their colleagues and flexibly set their working status.

FB also releases a corporate version of social media which is Workplace. The main attracting point is the contents are ad-free and you can expect to see company update or department news from the nesfeed.

4 0
3 years ago
What is a Boolean Expression?
ratelena [41]
The answer is C, an expression that evaluates to true or false.

In computer science, a Boolean expression is an expression used in programming languages that produces a Boolean value when evaluated. A Boolean value is either true or false.

( Lol. I’m in 7th grade doing college work, so this was fun to answer! )
4 0
3 years ago
I’m so lost. which username do i do.
koban [17]

Answer:

the username you feel like using

5 0
3 years ago
Read 2 more answers
Other questions:
  • Cleaning the keyboard is the most important part of keeping your computer running at peak performance.
    5·2 answers
  • A half-life is the amount of time it takes for a substance or entity to fall to half its original value. Caffeine has a half-lif
    10·1 answer
  • What is the internet?
    5·2 answers
  • HURRY!! Ill give brainily and 25 points. Describe how Scent is related to the culture and historical period when it was created.
    15·1 answer
  • An investor is considering in which of two start-up companies to invest. The investor has faith in the industrial organization (
    9·2 answers
  • How designers have created products from waste materials?
    7·1 answer
  • Hey I don’t have a question I’m just testing something on this app
    6·2 answers
  • A _____ are devices that permit a user to connect to a digital t-carrier service.
    6·1 answer
  • 4.7 code practice question 2 edhesive i cant figure out the code for this problem csn anyone help me?
    5·1 answer
  • A ____ is an Access feature that makes it easy to enter data.
    7·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!