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
Which item is not part of a college application
olga_2 [115]

Answer:

Explanation:

application form and any fees

4 0
2 years ago
When testing a game, why might you consider throttling the game’s “frames per second”?
Ivenika [448]

Answer:

because if you throttle it then

you can make sure it's okay

4 0
2 years ago
PL I BEG YOU HELP
Murrr4er [49]

Answer:

Answers in explanation. Try to ask one question at a time, it is easier for people to answer single questions and you will get answers faster.

Explanation:

15. A

16. D

17. B + C

18. A+B+D

19. B+C+D

**20. is NOT Planned personal leave for documentation developers and proof readers. The other 4 answers are correct

21. Presentation notes + Outline

22.B

23.D (im not entirely sure about this one)    

8 0
3 years ago
The internet has provided great opportunities for fundraising. true/false
alekssr [168]
True, sites such as kickstarter and just giving are fantastic examples of such.
8 0
3 years ago
Select the correct answer.
tia_tia [17]

Answer:

A

Explanation:

HTML is a coding language.

8 0
3 years ago
Other questions:
  • An array UnsortedInt consists of integers in random order. Another array SortedInt consists of a sorted list of integers.
    13·1 answer
  • What is the output of the following C++ program?
    15·1 answer
  • A word object in an excel worksheet to activate the word features
    9·1 answer
  • What is the best way to learn JavaScript?
    5·2 answers
  • Write a function called show_info that takes a name, a home city, and a home state (a total of 3 arguments) and returns a full s
    12·1 answer
  • When USB flash drives started becoming popular, customers stopped purchasing CDs. As a result, USB flash drives almost completel
    5·1 answer
  • What is the Slide Sorter View used for?
    12·2 answers
  • HURRY please!!!!
    13·1 answer
  • Which of the following is typiacally the last step of the mail merge process
    11·1 answer
  • the first thing to do when your computer gives you an error message is A restart the computer B press the F2 key C write down th
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!