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
Alik [6]
3 years ago
9

The array s of ints contain integers each of which is between 1 and 1000 (inclusive). write code that stores in the variable ord

inals the array of strings consisting of each number followed by its ordinal number abbreviation, "st", "nd", "rd", or "th". for example if s is the array
Computers and Technology
1 answer:
bearhunter [10]3 years ago
7 0

Answer and  Explanation

An array holds a fixed number of values of a single type. Its length is established when the array is created where the length is fixed after the creation.In c programming an array is a collection of data items all of them of the same type and accessed using a common name while in Java  they are items that are dynamically created and all elements have the same type called the component type  of the array.

//takes an array of int and returns an array of String the way you want!  

public String[] setOrdinal(int[] arr)  

{  

String[] ord = new String[arr.length];  

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

{  

ord[i] = convert(arr[i]);  

}  

return ord;  

}  


//takes a number and converts it to string and adds the proper letters


private String convert(int num)  

{  

if(num > 1000 || num <=0)  

return "Not in range";  

else if(num%10==0 || num%10==9 || num%10==8 || num%10==7 || num%10==6 || num%10==5 || num%10==4 || num%10==3)  

{  

return String.valueOf(num) + "th";  

}  

else if(num%10==2)  

{  

if((num/10)%10==1) //checks if the second digit is 1  

return String.valueOf(num) + "th";  

else  

return String.valueOf(num) + "nd";  

}  

else  

{  

if((num/10)%10==1)  

return String.valueOf(num) + "th";  

else  

return String.valueOf(num) + "st";  

}

}

You might be interested in
Dynamic addressing: __________.
Anarel [89]

Explanation:

jwjajahabauiqjqjwjajjwwjnwaj

6 0
3 years ago
Read 2 more answers
What is one reason why a business may want to move entirely online?
andrezito [222]

Answer:

To focus on global market

Explanation:

Hope this helps! :)

3 0
3 years ago
What type of authentication does the dod require to access sensitive data on mobile devices and/or e-mail?
motikmotik
<span>Actually dod requires a digital type of authentication and a secure password inorder to access sensitive data on mobile devices and email, which may in the form of two step authentication code, then in the form digital phone calls, and then in the form of alphanumeric passwords and finally in the form of finger prints authentications or face recognition verification..</span>
8 0
3 years ago
Which of the following commands should you use to determine whether there are any shared resources on a Windows computer with th
Law Incorporation [45]

Answer:

c. nbtstat -a 193.145.85.202

Explanation:

Nbtstat is a TCP/IP utility which is used to display the current connections and statistics of TCP/IP using NetBIOS over TCP/IP (NetBT).

It is installed on a computer running Microsoft Windows when the TCP/IP protocol stack is installed.

Also, it is very useful when we want to troubleshoot NetBIOS name resolution problems.

One can run nbtstat -a < ComputerName > to obtain the local NetBIOS name table on <ComputerName> and its MAC address

7 0
3 years ago
Read 2 more answers
Which of the following best meets the requirements of a strong password?
Hoochie [10]

Answer:

having a capital and lower case letters and a special characters and numbers.

Explanation:

it should be hard but easy enough to remember and no one will know

6 0
3 years ago
Read 2 more answers
Other questions:
  • A ___ block unauthorized access to a network or an individual computer
    8·1 answer
  • Design a Geometry class with the following methods: A static method that accepts the radius of a circle and returns the area of
    15·1 answer
  • What is a computer network?
    5·1 answer
  • A computer essentially takes input, processes it, and produces output. Which person developed a machine in the mid-1880s that ac
    6·1 answer
  • I need help with this line of code:
    5·1 answer
  • Pls help have absolutely no clue how to delete this
    12·2 answers
  • How do you fix this!!!!
    5·1 answer
  • From where do we get information or knowledge? Explain.
    12·2 answers
  • 20 POINTS! Which music making software is better? Ableton Live or Logic Pro? Name the advantages and disadvantages of each one!
    7·2 answers
  • What are the nuclear codes?
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!