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
olya-2409 [2.1K]
4 years ago
8

Write a complete main method that does the following: 1. Takes any number, but at least two, command line arguments which are nu

mbers (represented as strings) and will print to the console the number of numbers that are evenly divisible by 10. (Hint: loop through the args array) 2. If there are not at least two command line arguments, throw an IllegalArgumentException with an appropriate message.
Computers and Technology
1 answer:
Bess [88]4 years ago
8 0

Answer:

public static void main (String [] args) {

       

   public static void main (String [] args) {

       

       int count = 0;

       int[] arr = new int[args.length];

     if(args.length >=2) {

       for(int i=0; i<args.length; i++) {

           arr[i] = Integer.parseInt(args[i]);

           if(arr[i] % 10 == 0)

                      count++;

        }

     }

   else

        throw new IllegalArgumentException("Missing arguments!");

   

       System.out.println("There are " + count + " numbers that are divisible by 10");

   }

Explanation:

- Create a variable <em>count</em> to hold the count of the numbers divisible by 10

- Initialize an integer array to hold the inputs

- Check the number of arguments that are passed as a parameter. If it is greater than 2, parse the numbers into the <em>arr.</em> Then check the numbers that are divisible by 10, if number satisfies the condition, increment the <em>count </em>by 1.<em> </em>If the length of arguments passed is less than 2, throw an exception

Then:

Print the <em>count</em>

You might be interested in
Please help, will give brainliest!!! I need help with these coding questions, any help is appreciated
olchik [2.2K]

Answer:

class Foo:

   def F(self, n):

       if n == 1:

           return 1

       return self.F(n - 1) + 3 * n - 2

Explanation:

This should cover part a to this question. The thing I'm not sure on is they use the term "method" which in python technically means a class function...but then list one argument with the function call which makes me think it is possibly just supposed to be a regular function. Which would be the following snippet. It would depend on if you are using classes or not yet in your coding class.

def F(n):

   if n == 1:

       return 1

   return F(n - 1) + 3 * n - 2

Play around with it and look into python "lists" and "for loops" for part c. Part b I'm not sure what kind of example they want since I'm not in that class. Good luck!

8 0
3 years ago
Explain how any simple substitution cipher that involves a permutation of the alphabet can be thought of as a special case of th
Kaylis [27]

A simple substitution cipher takes each vector (e_i) and assigns it to the vectors [e_{\pi (i)}] in a one-to-one function so as to make them equivalent.

<h3>What is the Hill cipher?</h3>

In 1929, the Hill cipher was invented by Lester S. Hill and it can be described as a poly-graphic substitution cipher that is typically based on linear algebra and it avails a cryptographer an ability to simultaneously operate on more than three (3) symbols.

In Cryptography, the simple substitution cipher is usually viewed as a function which takes each plaintext letter (alphabet) and assigns it to a ciphertext letter. Thus, it takes each vector (e_i) and assigns it to the vectors [e_{\pi (i)}] in a one-to-one function so as to make them equivalent.

Read more on Hill cipher here: brainly.com/question/13155546

#SPJ1

6 0
2 years ago
How do you show your parents you are responsible enough for a phone?
alexandr1967 [171]
You can show your parents that you're responsible enough for a phone by volunteering to wash the dishes, or taking care of your siblings. Doing little stuff can prove that you're responsible. You should ask them, what they require you do to for a phone.
Good Luck!
4 0
3 years ago
Read 2 more answers
The ability to create slide shows is a major advantage of word processing software.
Gennadij [26K]
The correct answer is false
8 0
3 years ago
The Task Manager can be used ot track running _________________ .
Nikitich [7]

Answer:

Processes

Explanation:

The Windows Task Manager helps us track processes running on the system.

It can be invoked by pressing Ctrl+Alt+Delete and selecting the 'Task Manager' option or by right clicking on the status bar and choosing 'Task Manager' menu item. Besides the running process name it also provides supplementary information about the process such as :

  • CPU
  • Memory
  • Disk
  • Network
5 0
3 years ago
Other questions:
  • HELP NOW PLZZ/ Question: Complete the sentence with the correct response.
    11·1 answer
  • A coworker asks your opinion about how to minimize ActiveX attacks while she browses the Internet using Internet Explorer. The c
    12·1 answer
  • "Write code that prints: Ready! countNum ... 2 1 Start! Your code should contain a for loop. Print a newline after each number a
    7·1 answer
  • Who can help me with 50 varables on codeskulptor​
    8·1 answer
  • What dose AUP stand for??????????
    15·2 answers
  • Hey does anyone know the name of that movie where like this teenage girl is chilling at her house then there is an outbreak of s
    6·1 answer
  • What are Operating Systems?
    8·1 answer
  • Edit the following statement so it uses the constant named YEAR:
    5·1 answer
  • What is the difference between referential and entity integrity
    11·1 answer
  • Which one of these are a valid IPv4 address?
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!