answer.
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
Deffense [45]
1 year ago
6

Write a code segment that uses an enhanced for loop to print all elements of words that end with "ing". As an example, if words

contains {"ten", "fading", "post", "card", "thunder", "hinge", "trailing", "batting"}, then the following output should be produced by the code segment. fading trailing batting Write the code segment as described above. The code segment must use an enhanced for loop to earn full credit.
Computers and Technology
1 answer:
nadezda [96]1 year ago
6 0

Answer:

 public static void main(String[] args) {

   String ing[] = {"ten","fading","post","card","thunder","hinge","trailing","batting"};

   for (String i: ing){

     if (i.endsWith("ing")){

       System.out.println(i);

    }

   }

 }

Explanation:

The for-loop cycles through the entire list and the if-statement makes it so that the string is only printed if it ends with "ing"

You might be interested in
Consider a disk that rotates at 3600 rpm. The seek time to move the head between adjacent tracks is 2 ms. There are 32 sectors p
jasenka [17]

Answer:

19.71 ms

Explanation:

The disk rotates at 3600 rpm, hence the time for one revolution = 60 / 3600 rpm = 16.67 ms.

Hence time to read or write on a sector = time for one revolution / number of sectors per track = 16.67 ms / 32 sectors = 0.52 ms

Head movement time from track 8 to track  9 = seek time = 2 ms

rotation time to head up sector 1 on track 8 to sector 1 on track 9 = 16.67 * 31/32 = 16.15 ms

The total time = sector read time +head movement time + rotational delay + sector write time = 0.52 ms + 2 ms + 16.15 ms + 0.52 ms = 19.19 ms

3 0
1 year ago
A signal travels from point A to point B. At point A, the signal power is 100 W. At point B, the power is 90 W. What is the atte
11Alexandr11 [23.1K]

Answer:

Attenuation = 0.458\ db

Explanation:

Given

Power at point A = 100W

Power at point B = 90W

Required

Determine the attenuation in decibels

Attenuation is calculated using the following formula

Attenuation = 10Log_{10}\frac{P_s}{P_d}

Where P_s = Power\ Input and P_d  = Power\ output

P_s = 100W

P_d = 90W

Substitute these values in the given formula

Attenuation = 10Log_{10}\frac{P_s}{P_d}

Attenuation = 10Log_{10}\frac{100}{90}

Attenuation = 10 * 0.04575749056

Attenuation = 0.4575749056

Attenuation = 0.458\ db <em>(Approximated)</em>

7 0
2 years ago
If there are 8 opcodes and 10 registers, a. What is the minimum number of bits required to represent the OPCODE? b. What is the
Nimfa-mama [501]

Answer:  

For 32 bits Instruction Format:

OPCODE   DR               SR1                   SR2      Unused bits

a) Minimum number of bits required to represent the OPCODE = 3 bits

There are 8 opcodes. Patterns required for these opcodes must be unique. For this purpose, take log base 2 of 8 and then ceil the result.

Ceil (log2 (8)) = 3

b) Minimum number of bits For Destination Register(DR) = 4 bits

There are 10 registers. For unique register values take log base 2 of 10 and then ceil the value.  4 bits are required for each register. Hence, DR, SR1 and SR2 all require 12 bits in all.  

Ceil (log2 (10)) = 4

c) Maximum number of UNUSED bits in Instruction encoding = 17 bits

Total number of bits used = bits used for registers + bits used for OPCODE  

     = 12 + 3 = 15  

Total  number of bits for instruction format = 32  

Maximum  No. of Unused bits = 32 – 15 = 17 bits  

OPCODE                DR              SR1             SR2              Unused bits

  3 bits              4 bits          4 bits           4 bits                17 bits

7 0
1 year ago
Write a sequence of statements that create a file named "greeting" and write a single line consisting of "Hello, World!" to that
tia_tia [17]

Answer:

The solution code is written in Python 3 as below:

  1. outfile = open("greeting.txt", "w")
  2. outfile.write("Hello World")
  3. outfile.close()

Explanation:

To create a simple text file in Python, we can use Python built-in function, <em>open()</em>. There are two parameters needed for the open() function,

  1. the file name and
  2. a single keyword "w". "w" denote "write". This keyword will tell our program to create a file if the file doesn't exist.

The statement <em>open("greeting.txt", "w")</em> will create a text file named "<em>greeting.txt</em>" (Line 1)

To fill up the content in the greeting.txt, we use <em>write()</em> method. Just include the content string as the argument of the <em>write()</em> method. (Line 2)

At last, we use <em>close() </em>method to close the opened file,<em> outfile</em>. This will release the system resource from the<em> outfile.</em>

4 0
1 year ago
What does Josh Silverman name as the most important aspect of managing finances?
Andre45 [30]

The answer is a the first one

6 0
1 year ago
Read 2 more answers
Other questions:
  • What are the two most important network-layer functions in a datagram network? what are the three most important network-layer f
    7·1 answer
  • A(n) _____ can be used to reveal a competitor’s program code, which can then be used to develop a new program that either duplic
    9·1 answer
  • In cell B16, enter a function to calculate the total attendance for the years 2014 through 2018 using the totals in the range B1
    10·1 answer
  • In the game of $Mindmaster$, secret codes are created by placing pegs of any of seven different colors into four slots. Colors m
    5·1 answer
  • Create a division formula.
    9·1 answer
  • Garrett wants to search through a csv file to find all rows that have either the name John or Bob in them and display them out t
    9·1 answer
  • Access-lists pose a logical problem which often has more than one solution. Can you think of a different set of rules or placeme
    8·1 answer
  • A 1.17 g sample of an alkane hydrocarbon gas occupies a volume of 674 mL at 28°C and 741 mmHg. Alkanes are known to have the gen
    14·1 answer
  • Which of the following statements is true regarding input and output?
    12·2 answers
  • Computers represent color by combining the sub-colors red, green, and blue (rgb). Each sub-color's value can range from 0 to 255
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!