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
What version of ubuntu is linux mint 17.3 based on?
aliina [53]
It would be version 14.04! I run Ubuntu Linux on my pc with dual boot with Kali Linux! I hope this helped!

3 0
3 years ago
In addition to compiling the list of user access requirements, applications, and systems, the BIA also includes processes that a
laila [671]

Answer:

automated

Explanation:

Basically a Business Impact Analysis (BIA) estimates and determines the effects of a business activity and process disturbances. These disruptions can be natural or electronic disasters. It also collects information which is used to establish recovery plan. It identifies the business vulnerabilities and works on the strategies in order to reduce such potential hazards. The BIA involves both manual and automated processes. BIA involves automated processes which include the automated software tools that enables the protection of the confidential information of the users and also generates automated reports about the critical business processes.

5 0
3 years ago
Ok can someone tell me why I can’t do this? I’m trying to put a video as my background but it won’t show up when I go to add vid
hram777 [196]

Answer: money

Explanation:

3 0
2 years ago
The sum of these 9 numbers is 36. 2, 2, 6, 2, 1, 8, 7, 5, 3 What is the mean of these 9 numbers?
fiasKO [112]

Answer:

4

Explanation:

The mean is the sum divided by the count of numbers, so 36/9 = 4

6 0
2 years ago
Read 2 more answers
Which of the following is the smallest aperture (f-stop) opening?
Firlakuza [10]

Answer:

E) f/16

Explanation:

6 0
3 years ago
Other questions:
  • You took a fantastic photograph that you want to use in the report you're writing using DTP software. To import the photo into y
    6·2 answers
  • In order to allow communication between vlans for exchange of data what must be used?​
    15·1 answer
  • A ____________ variable is available throughout a program.
    7·1 answer
  • A company uses the account code 669 for maintenance expense. However, one of the company's clerks often codes maintenance expens
    15·1 answer
  • What is the primary reason that organizations change their structure through downsizing, outsourcing, and offshoring as a means
    14·1 answer
  • If you want to distribute a formatted Microsoft word document to people who don't have word save it as a __file
    5·1 answer
  • HELP PLEASE I WILL GIVE YOU 15 POINTS!
    8·1 answer
  • A small company with 100 computers has hired you to install a local area network. All of the users perform functions like email,
    9·1 answer
  • What dog breed is this
    6·1 answer
  • Please please help I don’t understand this please.
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!